1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

4.5 
(8115 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 23, 2024Last update

Oracle 1Z0-803 Free Practice Questions

Q1. 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:

Q2. Which code fragment cause a compilation error? 

A. flat flt = 100F; 

B. float flt = (float) 1_11.00; 

C. float flt = 100; 

D. double y1 = 203.22; floatflt = y1 

E. int y2 = 100; floatflt = (float) y2; 

Answer:

Q3. 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:

Q4. Given: 

Which three lines will compile and output “right on!”? 

A. Line 5 

B. Line 6 

C. Line 7 

D. Line 8 

E. Line 9 

F. Line 10 

Answer: CDF 

Q5. Given: 

How many objects have been created when the line / / do complex stuff is reached? 

A. Two 

B. Three 

C. Four 

D. Six 

Answer:

Q6. Which code fragment is illegal? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q7. Given: 

What is the result? 

A. true true 

B. true false 

C. false true 

D. false false 

E. Compilation fails 

Answer:

Q8. Given the fragments: 

Which line causes a compilation error? 

A. Line n1 

B. Line n2 

C. Line n3 

D. Line n4 

Answer:

Q9. 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:

Q10. Given: 

class X {} 

class Y { Y ( ) { } } 

class Z { Z (int i ) { } } 

Which class has a default constructor? 

A. X only 

B. Y only 

C. Z only 

D. X and Y 

E. Y and Z 

F. X and Z 

G. X, Y and Z 

Answer:

Q11. Given: 

Given the for loop construct: 

Which constructor initializes the variable x3? 

A. Only the default constructor of class X 

B. Only the no-argument constructor of class Y 

C. Only the no-argument constructor of class Z 

D. Only the default constructor of object class 

Answer:

Q12. What is the result? 

A. 100 210 

B. Compilation fails due to an error in line n1 

C. Compilation fails due to an error at line n2 

D. Compilation fails due to an error at line n3 

Answer:

Q13. 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:

Q14. Given: 

What is the result? 

A. null 

B. compilation fails 

C. Java.lang.NullPointerException 

D. 0 

Answer:

Q15. What is the proper way to defined a method that take two int values and returns their sum as an int value? 

A. int sum(int first, int second) { first + second; } 

B. int sum(int first, second) { return first + second; } 

C. sum(int first, int second) { return first + second; } 

D. int sum(int first, int second) { return first + second; } 

E. void sum (int first, int second) { return first + second; } 

Answer:

Q16. Given: 

public class Main { 

public static void main(String[] args) { 

try { 

doSomething(); 

catch (SpecialException e) { 

System.out.println(e); 

}} 

static void doSomething() { 

int [] ages = new int[4]; 

ages[4] = 17; 

doSomethingElse(); 

static void doSomethingElse() { 

throw new SpecialException("Thrown at end of doSomething() method"); } 

What is the output? 

A. SpecialException: Thrown at end of doSomething() method 

B. Error in thread "main" java.lang. 

ArrayIndexOutOfBoundseror 

C. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 

at Main.doSomething(Main.java:12) 

at Main.main(Main.java:4) 

D. SpecialException: Thrown at end of doSomething() method at 

Main.doSomethingElse(Main.java:16) 

at Main.doSomething(Main.java:13) 

at Main.main(Main.java:4) 

Answer:

START 1Z0-803 EXAM