Q1. Given:
How many objects have been created when the line / / do complex stuff is reached?
A. Two
B. Three
C. Four
D. Six
Answer: C
Q2. Class StaticField {
static int i = 7;
public static void main(String[] args) {
StaticFied obj = new StaticField();
obj.i++;
StaticField.i++;
obj.i++;
System.out.println(StaticField.i + " "+ obj.i);
}
}
What is the result?
A. 10 10
B. 8 9
C. 9 8
D. 7 10
Answer: A
Q3. Given:
What is the result?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
Q4. Given the code fragment:
String h1 = "Bob";
String h2 = new String ("Bob");
What is the best way to test that the values of h1 and h2 are the same?
A. if (h1 = = h2)
B. if (h1.equals(h2))
C. if (h1 = = h2)
D. if (h1.same(h2))
Answer: B
Q5. Given:
What is the result?
A. One
B. Two
C. Three
D. Compilation fails
Answer: C
Q6. What is the result when this program is executed?
A. Bob's Name: Bob
B. Bob's Name: Jian
C. Nothing prints
D. Bob’s name
Answer: B
Q7. Given:
What is the result?
Oracle 1z0-803 : Practice Test
A. 0 Done
B. First Exception Done
C. Second Exception
D. Done Third Exception
E. Third Exception
Answer: B