1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

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

Oracle 1Z0-803 Free Practice Questions

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

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

Q3. Given: 

Javac Jump.java 

Java Jump crazy elephant is always 

What is the result? 

A. Lazy lion is jumping 

B. Lion is always jumping 

C. Crazy elephant is jumping 

D. Elephant is always jumping 

E. Compilation fails 

Answer:

Q4. Given: 

What is the result? 

A. 11, 21, 31, 11, 21, 31 

B. 11, 21, 31, 12, 22, 32 

C. 12, 22, 32, 12, 22, 32 

D. 10, 20, 30, 10, 20, 30 

Answer:

Q5. What is result? 

A. Successful 

B. Unsuccessful 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

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

Q7. Given: 

What is the result? 

A. One 

B. Two 

C. Three 

D. Compilation fails 

Answer:

Q8. Given: 

And the commands: 

Javac Test.java 

Java Test 12345 

What is the result? 

A. Number us : 12345 

B. A NullPointerException is thrown at runtime 

C. A NumberFormatException is thrown at runtime 

D. AnArrayIndexOutOfBoundException is thrown at runtime. 

Answer:

Q9. View the Exhibit. 

public class Hat { 

public int ID =0; 

public String name = "hat"; 

public String size = "One Size Fit All"; 

public String color=""; 

public String getName() { return name; } 

public void setName(String name) { 

this.name = name; 

Given 

public class TestHat { 

public static void main(String[] args) { 

Hat blackCowboyHat = new Hat(); 

Which statement sets the name of the Hat instance? 

A. blackCowboyHat.setName = "Cowboy Hat"; 

B. setName("Cowboy Hat"); 

C. Hat.setName("Cowboy Hat"); 

D. blackCowboyHat.setName("Cowboy Hat"); 

Answer:

Q10. racle 1z0-803 : Practice Test 

j = (3 * ((2+4) + 5)); 

System.out.println("i:"+ i + "\nj":+j); 

What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q11. Given: 

A. X XX 

B. X Y X 

C. Y Y X 

D. Y YY 

Answer:

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

Q13. A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results? 

A. Compilation fails. 

B. The third argument is given the value null. 

C. The third argument is given the value void. 

D. The third argument is given the value zero. 

E. The third argument is given the appropriate falsy value for its declared type. 

F. An exception occurs when the method attempts to access the third argument. 

Answer:

Q14. Given: 

Class A { } 

Class B { } 

Interface X { } 

Interface Y { } 

Which two definitions of class C are valid? 

A. Class C extends A implements X { } 

B. Class C implements Y extends B { } 

C. Class C extends A, B { } 

D. Class C implements X, Y extends B { } 

E. Class C extends B implements X, Y { } 

Answer: AE 

Q15. 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 

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

START 1Z0-803 EXAM