Oracle Java SE 8 Programmer I - 1z1-808 Exam Practice Test
Question 1
Given the code fragment:
StringBuilder sb = new StringBuilder();
sb.append("World");
Which fragment prints Hello World?
sb.insert(0, "Hello ");
StringBuilder sb = new StringBuilder();
sb.append("World");
Which fragment prints Hello World?
sb.insert(0, "Hello ");
Correct Answer: A
Question 2
Given:

What is the result?

What is the result?
Correct Answer: D
Question 3
Given:
What is the result?

What is the result?

Correct Answer: B
Question 4
Given:

and the code fragment:
S2 sobj = new S2();
sobj.display(10, 100);
What is the result?

and the code fragment:
S2 sobj = new S2();
sobj.display(10, 100);
What is the result?
Correct Answer: C
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 5
Which two initialization statements are valid? (Choose two.)
Correct Answer: C,D
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 6
Given the code fragment:

What is the result?

What is the result?
Correct Answer: A
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 7
Given the classes:
* AssertionError
* ArithmeticException
* ArrayIndexOutofBoundsException
* FileNotFoundException
* IllegalArgumentException
* IOError
* IOException
* NumberFormatException
* SQLException
Which option lists only those classes that belong to the unchecked exception category?
* AssertionError
* ArithmeticException
* ArrayIndexOutofBoundsException
* FileNotFoundException
* IllegalArgumentException
* IOError
* IOException
* NumberFormatException
* SQLException
Which option lists only those classes that belong to the unchecked exception category?
Correct Answer: E
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 8
Given the code fragment:

Which three code fragments can be independently inserted at line nl to enable the code to print one?

Which three code fragments can be independently inserted at line nl to enable the code to print one?
Correct Answer: A,C,F
Question 9
Given the code fragment:

What is the result?

What is the result?
Correct Answer: B
Question 10
Given the code fragment:

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order?

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order?
Correct Answer: C,E
Question 11
Given:

What is the result?

What is the result?
Correct Answer: E
Question 12
Which two statements are true about Java byte code? (Choose two.)
Correct Answer: C,D
Question 13
Given:
public class TestOperator {
public static void main(String[] args) {
int result = 30 -12 / (2*5)+1;
System.out.print("Result = " + result);
}
}
What is the result?
public class TestOperator {
public static void main(String[] args) {
int result = 30 -12 / (2*5)+1;
System.out.print("Result = " + result);
}
}
What is the result?
Correct Answer: E
Question 14
Given:

Which two classes use the shape class correctly?


Which two classes use the shape class correctly?

Correct Answer: A,C
Explanation: Only visible for Actualtests4sure members. You can sign-up / login (it's free).
Question 15
Which three are valid replacements for foo so that the program will compiled and run?
public class ForTest {
public static void main(String[] args) {
int[] arrar = {1,2,3};
for ( foo ) {
}
}
}
public class ForTest {
public static void main(String[] args) {
int[] arrar = {1,2,3};
for ( foo ) {
}
}
}
Correct Answer: B,D,E

