Oracle (1Z0-808) Exam Questions And Answers page 13
Which is true about the switch statement?
The break statement, at the end of each case block, is optional.
Its case label literals can be changed at runtime.
It must contain the default section.
Using Operators and Decision Constructs
Which code example uses valid Java syntax?
Single Choice
Which one of the following code examples uses valid Java syntax?
Option A
Option B
Option C
Option D
Java Basics
Using Operators and Decision Constructs
What is the truth about Java byte code?
Single Choice
Which statement is true about Java byte code?
It can run on any platform.
It can run on any platform only if it was compiled for that platform.
It can run on any platform that has the Java Runtime Environment.
It can run on any platform that has a Java compiler.
It can run on any platform only if that platform has both the Java Runtime Environment and a Java compiler.
Using Operators and Decision Constructs
Working with Methods and Encapsulation
What is the truth about the switch statement?
Single Choice
Which statement is true about the switch statement?
It must contain the default section.
The break statement, at the end of each case block, is mandatory.
Its case label literals can be changed at runtime.
Its expression must evaluate to a single value.
Using Operators and Decision Constructs
Which statement will empty the contents of a StringBuilder variable named sb?
sb. deleteAll ();
sb. delete (0, sb. size () );
sb. delete (0, sb. length () );
sb. removeAll ();
Working with Java Data Types
Working with Methods and Encapsulation
Which three statements are true about the structure of a Java class? (Choose three.)
A public class must have a main method.
A class can have only one private constructor.
A method can have the same name as a field.
A class can have overloaded static methods.
The methods are mandatory components of a class.
The fields need not be initialized before use.
Using Operators and Decision Constructs
Working with Methods and Encapsulation
Which three statements are true about the structure of a Java class? (Choose three.)
A class cannot have the same name as its field.
A public class must have a main method.
A class can have final static methods.
A class can have overloaded private constructors.
Fields need to be initialized before use.
Methods and fields are optional components of a class.
Using Operators and Decision Constructs
Working with Methods and Encapsulation
What are three object-oriented features of the Java language?
Multiple Choice
Which three statements describe the object-oriented features of the Java language? (Choose three.)
Objects can be reused.
A subclass must override the methods from a superclass.
Objects can share behaviors with other objects.
A package must contain a main class.
Object is the root class of all other objects.
A main method must be declared in every class.
Working with Methods and Encapsulation
Working with Inheritance
What are two benefits of polymorphism?
Multiple Choice
Which two are benefits of polymorphism? (Choose two.)
Faster code at runtime
More efficient code at runtime
More dynamic code at runtime
More flexible and reusable code
Code that is protected from extension by other classes
Working with Methods and Encapsulation
Working with Inheritance
Which class definitions in 1Z0-808 fail to compile?
Multiple Choice
Which two class definitions fail to compile? (Choose two.)
Comments