Oracle Java SE 8 Programmer I (1z0-808) Free Practice Test
Question 1
Given:

What is the result?

What is the result?
Correct Answer: A
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 2
Given:
class Mid {
public int findMid(int n1, int n2) {
return (n1 + n2) / 2;
}
}
public class Calc extends Mid {
public static void main(String[] args) {
int n1 = 22, n2 = 2;
// insert code here
System.out.print(n3);
}
}
Which two code fragments, when inserted at // insert code here, enable the code to compile and print 12?
class Mid {
public int findMid(int n1, int n2) {
return (n1 + n2) / 2;
}
}
public class Calc extends Mid {
public static void main(String[] args) {
int n1 = 22, n2 = 2;
// insert code here
System.out.print(n3);
}
}
Which two code fragments, when inserted at // insert code here, enable the code to compile and print 12?
Correct Answer: A,C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 3
Given:

What is the result?

What is the result?
Correct Answer: B
Question 4
Which two statements are true?
Correct Answer: D,E
Question 5
Given the code fragment:
for (int ii = 0; ii < 3;ii++) {
int count = 0;
for (int jj = 3; jj > 0; jj--) {
if (ii == jj) {
++count;
break;
}
}
System.out.print(count);
continue;
}
What is the result?
for (int ii = 0; ii < 3;ii++) {
int count = 0;
for (int jj = 3; jj > 0; jj--) {
if (ii == jj) {
++count;
break;
}
}
System.out.print(count);
continue;
}
What is the result?
Correct Answer: A
Question 6
Given:

And given the code fragment:

What is the result?

And given the code fragment:

What is the result?
Correct Answer: B
Question 7
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: B
Question 8
Given:

What is the result?

What is the result?
Correct Answer: D
Question 9
Give:

What is the result?

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

What is the result?

What is the result?
Correct Answer: A
Question 11
Given:

What is the result?

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

And the commands:
Javac Test.java
Java Test 12345
What is the result?

And the commands:
Javac Test.java
Java Test 12345
What is the result?
Correct Answer: C
Question 13
Given:

What is the result?

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

What is the result?

What is the result?
Correct Answer: A