1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

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

Oracle 1Z0-803 Free Practice Questions

Q1. Which two packages are automatically imported into the java source file by the java compiler? 

A. Java.lang 

B. Java.awt 

C. Java.util 

D. Javax.net 

E. Java.* 

F. The package with no name 

Answer: AF 

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

Q3. Given: 

What is the result? 

A. null 

B. compilation fails 

C. Java.lang.NullPointerException 

D. 0 

Answer:

Q4. boolean log3 = ( 5.0 != 6.0) && ( 4 != 5); 

boolean log4 = (4 != 4) || (4 == 4); 

System.out.println("log3:"+ log3 + \nlog4" + log4); 

What is the result? 

A. log3:false log4:true 

B. log3:true log4:true 

C. log3:true log4:false 

D. log3:false log4:false 

Answer:

Q5. Which two are valid declarations of a two-dimensional array? 

A. int [] [] array2D; 

B. int [2] [2] array2D; 

C. int array2D []; 

D. int [] array2D []; 

E. int [] [] array2D []; 

Answer: AD 

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

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

Q8. Given: 

Which statement, when inserted into line 5, is valid change? 

A. asc = sc; 

B. sc = asc; 

C. asc = (object) sc; 

D. asc = sc.clone () 

Answer:

Q9. Given: 

Which two declarations will compile? 

A. int a, b, c = 0; 

B. int a, b, c; 

C. int g, int h, int i = 0; 

D. int d, e, F; 

E. int k, l, m; = 0; 

Answer: AD 

Q10. Which two statements are true for a two-dimensional array? 

A. It is implemented as an array of the specified element type. 

B. Using a row by column convention, each row of a two-dimensional array must be of the same size. 

C. At declaration time, the number of elements of the array in each dimension must be specified. 

D. All methods of the class Object may be invoked on the two-dimensional array. 

Answer: AD 

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

Q12. Given: 

Which code fragment, when inserted at line 7, enables the code print true? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q13. public class MyFor { 

public static void main(String[] args) { 

for (int ii = 0; ii < 4; ii++) { 

System.out.println("ii = "+ ii); 

ii = ii +1; 

What is the result? 

A. ii = 0 

ii = 2 

B. ii = 0 

ii = 1 

ii = 2 

ii = 3 

C. ii = 

D. Compilation fails. 

Answer:

Q14. Which two statements are true? 

C. An interface CANNOT be extended by another interface. 

D. An interface can be extended by an abstract class. 

E. An abstract class can be extended by a concrete class. 

F. An abstract class CANNOT be extended by an abstract class. 

Answer: AE 

Q15. Given: 

What is true about the class Wow? 

A. It compiles without error. 

B. It does not compile because an abstract class cannot have private methods. 

C. It does not compile because an abstract class cannot have instance variables. 

D. It does not compile because an abstract class must have at least one abstract method. 

E. It does not compile because an abstract class must have a constructor with no arguments. 

Answer:

Q16. Which code fragments, inserted independently, enable the code compile? 

A. t.fvar = 200; 

B. cvar = 400; 

C. fvar = 200; cvar = 400; 

D. this.fvar = 200; this.cvar = 400; 

E. t.fvar = 200; Test2.cvar = 400; 

F. this.fvar = 200; Test2.cvar = 400; 

Answer:

START 1Z0-803 EXAM