1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

4.5 
(2040 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 5, 2024Last update

Oracle 1Z0-803 Free Practice Questions

Q1. int [] array = {1,2,3,4,5}; 

for (int i: array) { 

if ( i < 2) { 

keyword1 ; 

System.out.println(i); 

if ( i == 3) { 

keyword2 ; 

}} 

What should keyword1 and keyword2 be respectively, in oreder to produce output 2345? 

A. continue, break 

B. break, break 

C. break, continue 

D. continue, continue 

Answer:

Q2. Given the class definitions: 

And the code fragment of the main() method, 

What is the result? 

A. Java 

Java 

Java 

B. Java 

Jeve 

va 

C. Java 

Jeve 

ve 

D. Compilation fails 

Answer:

Q3. What is the result? 

A. Initialized 

Started 

B. Initialized 

Started 

Initialized 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

Q4. Given: 

Which code fragment, when inserted at line 14, enables the code to print Mike Found? 

A. int f = ps.indexOf {new patient (“Mike”)}; 

B. int f = ps.indexOf (patient(“Mike”)); 

C. patient p = new Patient (“Mike”); 

int f = pas.indexOf(P) 

D. int f = ps.indexOf(p2); 

Answer:

Q5. Given the fragment: 

What is the result? 

A. 13480.0 

B. 13480.02 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

Q6. Given: 

What is the result? 

A. Shining Sun 

Shining Sun 

Shining Sun 

B. Shining Sun 

Twinkling Star 

Shining Sun 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:

Q7. Which three are valid types for switch?

A. int

B. float

C. double

D. integer

E. String

F. Float

Answer: ADE

Q8. What is the result? 

A. sc: class.Object asc: class.AnotherSampleClass 

B. sc: class.SampleClass asc: class.AnotherSampleClass 

C. sc: class.AnotherSampleClass asc: class.SampleClass 

D. sc: class.AnotherSampleClass asc: class.AnotherSampleClass 

Answer:

Q9. Given: 

What is the result? 

A. One 

B. Two 

C. Three 

D. Compilation fails 

Answer:

Q10. Given the fragments: 

Which line causes a compilation error? 

A. Line n1 

B. Line n2 

C. Line n3 

D. Line n4 

Answer:

Q11. public class ForTest { 

public static void main(String[] args) { 

int[] arrar = {1,2,3}; 

for ( foo ) { 

Which three are valid replacements for foo so that the program will compiled and run? 

A. int i: array 

B. int i = 0; i < 1; i++ 

C. ;; 

D. ; i < 1; i++ 

E. ; i < 1; 

Answer: ABC 

Q12. Given the code fragment: 

What is the result? 

A. 28false29 true 

B. 285 < 429 true 

C. true true 

D. compilation fails 

Answer:

Q13. Given: 

What code should be inserted? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

F. Option F 

Answer:

Q14. Given: 

Which approach ensures that the class can be compiled and run? 

A. Put the throw new Exception() statement in the try block of try – catch 

B. Put the doSomethingElse() method in the try block of a try – catch 

C. Put the doSomething() method in the try block of a try – catch 

D. Put the doSomething() method and the doSomethingElse() method in the try block of a try – catch 

Answer:

Q15. The catch clause argument is always of type__________. 

A. Exception 

B. Exception but NOT including RuntimeException 

C. Throwable 

D. RuntimeException 

E. CheckedException 

F. Error 

Answer:

Q16. Given the code fragments: 

What is the result? 

A. Super 

Sub 

Sub 

B. Contract 

Contract 

Super 

C. Compilation fails at line n1 

D. Compilation fails at line n2 

Answer:

START 1Z0-803 EXAM