1Z0-803 Exam - Java SE 7 Programmer I

certleader.com

Q1. Given: 

What is the result? 

A. 6 5 6 4 

B. 6 5 5 4 

C. 6 5 6 6 

D. 6 5 6 5 

Answer:

Q2. class Overloading { 

int x(double d) { 

System.out.println("one"); 

return 0; 

String x(double d) { 

System.out.println("two"); 

return null; 

double x(double d) { 

System.out.println("three"); 

return 0.0; 

public static void main(String[] args) { 

new Overloading().x(4.0); 

What is the result? 

A. One 

B. Two 

C. Three 

D. Compilation fails. 

Answer:

Q3. Given: 

Which two code fragments are valid? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer: BC 

Q4. public class Two { 

public static void main(String[] args) { 

try { 

doStuff(); 

system.out.println("1"); 

catch { 

system.out.println("2"); 

}} 

public static void do Stuff() { 

if (Math.random() > 0.5) throw new RunTimeException(); doMoreStuff(); 

System.out.println("3 "); 

public static void doMoreStuff() { 

System.out.println("4"); 

Which two are possible outputs? 

A. 2 

B. 4 3 1 

C. 1 

D. 1 2 

Answer: AB 

Q5. Given: 

What is the result? 

A. null 

B. compilation fails 

C. Java.lang.NullPointerException 

D. 0 

Answer:

Q6. What is the result? 

A. 3 false 1 

B. 2 true 3 

C. 2 false 3 

D. 3 true 1 

E. 3 false 3 

F. 2 true 1 

G. 2 false 1 

Answer:

Q7. Given: 

What is the reference type of myZ and what is the type of the object it references? 

A. Reference type is Z; object type is Z. 

B. Reference type is Y; object type is Y. 

C. Reference type is Z; object type is Y. 

D. Reference type is X; object type is Z. 

Answer:

Q8. Given: 

Which line causes a compilation error? 

A. line x1 

B. line x2 

C. line x3 

D. line x4 

Answer:

Q9. What is the result? 

A. 6 7 8 

B. 7 8 9 

C. 0 1 2 

D. 6 8 10 

E. Compilation fails 

Answer:

Q10. public class StringReplace { 

public static void main(String[] args) { 

String message = "Hi everyone!"; 

System.out.println("message = " + message.replace("e", "X")); } 

What is the result? 

A. message = Hi everyone! 

B. message = Hi XvXryonX! 

C. A compile time error is produced. 

D. A runtime error is produced. 

E. message = 

F. message = Hi Xveryone! 

Answer: