1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

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

Oracle 1Z0-803 Free Practice Questions

Q1. Given: 

What is the result? 

A. x: 1 y: 2 

B. 3 y: 4 

C. x: 0 y: 0 

D. 3 y: 4 

E. x: 1 y: 2 

F. 0 y: 0 

G. x: 0 y: 0 

H. 0 y: 0 

Answer:

Q2. Which two actions will improve the encapsulation of a class? 

A. Changing the access modifier of a field from public to private 

B. Removing the public modifier from a class declaration 

C. Changing the return type of a method to void 

D. Returning a copy of the contents of an array or ArrayList instead of a direct reference 

Answer: AD 

Q3. Given: 

What is the result? 

A. 10 : 22 : 20 

B. 10 : 22 : 22 

C. 10 : 22 : 6 

D. 10 : 30 : 6 

Answer:

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. An exception is thrown at runtime 

D. 0 

Answer:

Q6. What is the result? 

A. 6 7 8 

B. 7 8 9 

C. 0 1 2 

D. 6 8 10 

E. Compilation fails 

Answer:

Q7. What is the result? 

A. Hello 

B. Default 

C. Compilation fails 

D. The program prints nothing 

E. An exception is thrown at run time 

Answer:

Q8. Given: 

What is the result? 

A. hEllOjAvA! 

B. Hello java! 

C. Out of limits hEllOjAvA! 

D. Out of limits 

Answer:

Q9. Given: 

A. Ym 

Xm2 

B. Ym 

Xm1 

C. Compilation fails 

D. A Class Cast Exception is thrown at runtime 

Answer:

Q10. Given: 

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

A. Two 

B. Three 

C. Four 

D. Six 

Answer:

Q11. Given: 

What is the result? 

A. There is no output 

B. d is output 

C. A StringIndexOutOfBoundsException is thrown at runtime 

D. An ArrayIndexOutOfBoundsException is thrown at runtime 

E. A NullPointException is thrown at runtime 

F. A StringArrayIndexOutOfBoundsException is thrown at runtime 

Answer:

Q12. Which two are valid array declaration? 

A. Object array[]; 

B. Boolean array[3]; 

C. int[] array; 

D. Float[2] array; 

Answer: AC 

Q13. The protected modifier on a Field declaration within a public class means that the field 

______________. 

A. Cannot be modified 

B. Can be read but not written from outside the class 

C. Can be read and written from this class and its subclasses only within the same 

package 

D. Can be read and written from this class and its subclasses defined in any package 

Answer:

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

Q15. Given: 

What is the result? 

A. 7 

B. 12 

C. 19 

D. Compilation fails 

E. An exception is thrown at run time 

Answer:

Q16. Given: 

What three modifications, made independently, made to class greet, enable the code to compile and run? 

A. line 6 replaced with handy.dandy.keystroke stroke = new KeyStroke ( ); 

B. line 6 replaced with handy.*.KeyStroke = new KeyStroke ( ); 

C. line 6 replaced with handy.dandy.KeyStroke Stroke = new handy.dandy.KeyStroke(); 

D. import handy.*; added before line 1 

E. import handy.dandy.*; added after line 1 

F. import handy.dandy,KeyStroke; added after line 1 

G. import handy.dandy.KeyStroke.typeException(); added before line 1 

Answer: CEF 

START 1Z0-803 EXAM