Oracle Java SE 8 Programmer I - 1z0-808 Exam Practice Test
Given:

What is the result?

What is the result?
Correct Answer: D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Given:

Which two code fragments are valid?


Which two code fragments are valid?

Correct Answer: B,C
Given these requirements:
- Bus and Boat are Vehicle type classes.
- The start() and stop() methods perform common operations across the
Vehicle class type.
- The ride() method performs a unique operations for each type of
Vehicle.
Which set of actions meets the requirements with optimized code?
- Bus and Boat are Vehicle type classes.
- The start() and stop() methods perform common operations across the
Vehicle class type.
- The ride() method performs a unique operations for each type of
Vehicle.
Which set of actions meets the requirements with optimized code?
Correct Answer: B
Given the class definitrions:
class Shape { }
class Square extends Shape { }
Given the variable declarations:
Shape shape1 = null;
Square square1 = null;
Which four compile?
class Shape { }
class Square extends Shape { }
Given the variable declarations:
Shape shape1 = null;
Square square1 = null;
Which four compile?
Correct Answer: A,C,D,F
Given the code fragment:
public class Test {
static String[][] arr =new String[3][];
private static void doPrint() {
//insert code here
}
public static void main(String[] args) {
String[] class1 = {"A","B","C"};
String[] class2 = {"L","M","N","O"};
String[] class3 = {"I","J"};
arr[0] = class1;
arr[1] = class2;
arr[2] = class3;
Test.doPrint();
}
}
Which code fragment, when inserted at line //insert code here, enables the code to print COJ?
public class Test {
static String[][] arr =new String[3][];
private static void doPrint() {
//insert code here
}
public static void main(String[] args) {
String[] class1 = {"A","B","C"};
String[] class2 = {"L","M","N","O"};
String[] class3 = {"I","J"};
arr[0] = class1;
arr[1] = class2;
arr[2] = class3;
Test.doPrint();
}
}
Which code fragment, when inserted at line //insert code here, enables the code to print COJ?
Correct Answer: A
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Given the following code for the classes MyException and Test:

What is the result?

What is the result?
Correct Answer: C
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Given:

What is the result?

What is the result?
Correct Answer: C
Given the code fragment:
StringBuilder sb = new StringBuilder ( ) ;
Sb.append ("world");
Which code fragment prints Hello World?
StringBuilder sb = new StringBuilder ( ) ;
Sb.append ("world");
Which code fragment prints Hello World?
Correct Answer: C
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Given the code in a file Traveler.java:

And the commands:
Javac Traveler.java
Java Traveler Java Duke
What is the result?

And the commands:
Javac Traveler.java
Java Traveler Java Duke
What is the result?
Correct Answer: A
Given the code fragment:

What is the result?

What is the result?
Correct Answer: E
Which two are valid declarations of a two-dimensional array?
Correct Answer: C,D
Explanation: Only visible for TrainingDump members. You can sign-up / login (it's free).
Which two are valid array declaration?
Correct Answer: C,D