1Z0-803 Premium Bundle

1Z0-803 Premium Bundle

Java SE 7 Programmer I Certification Exam

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

Oracle 1Z0-803 Free Practice Questions

Q1. What is the result? 

A. Valid 

B. Not valid 

C. Compilation fails 

D. An IllegalArgumentException is thrown at run time 

Answer:

Q2. Given the code fragment: 

int b = 3; 

Oracle 1z0-803 : Practice Test 

if ( !(b > 3)) { 

System.out.println("square "); 

}{ 

System.out.println("circle "); 

System.out.println("..."); 

What is the result? 

A. square... 

B. circle... 

C. squarecircle... 

D. Compilation fails. 

Answer:

Q3. Int [] [] array = {{0}, {0, 1}, {0, 2, 4}, {0, 3, 6, 9}, {0, 4, 8, 12, 16}}; 

Systemout.printIn(array [4] [1]); 

System.out.printIn (array) [1] [4]); 

What is the result? 

A. 4 Null 

B. Null 4 

C. An IllegalArgumentException is thrown at run time 

D. 4 An ArrayIndexOutOfBoundException is thrown at run time 

Answer:

Q4. Given the code fragment: 

What could expression1 and expression2 be, respectively, in order to produce output –8, 16? 

A. + +a, - -b 

B. + +a, b- 

C. A+ +, - - b 

D. A + +, b - 

Answer:

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

Q6. Which two items can legally be contained within a java class declaration? 

A. An import statement 

B. A field declaration 

C. A package declaration 

D. A method declaration 

Answer: BD 

Q7. Which is a valid abstract class? 

A. public abstract class Car { 

protected void accelerate(); 

B. public interface Car { 

protected abstract void accelerate(); 

C. public abstract class Car { 

protected final void accelerate(); 

D. public abstract class Car { 

protected abstract void accelerate(); 

E. public abstract class Car { 

protected abstract void accelerate() { 

//more car can do 

}} 

Answer:

Q8. View the exhibit: 

public class Student { 

public String name = ""; 

public int age = 0; 

public String major = "Undeclared"; 

public boolean fulltime = true; 

public void display() { 

System.out.println("Name: " + name + " Major: " + major); } 

public boolean isFullTime() { 

return fulltime; 

Which line of code initializes a student instance? 

A. Student student1; 

B. Student student1 = Student.new(); 

C. Student student1 = new Student(); 

D. Student student1 = Student(); 

Answer:

Q9. Given: 

How many times is 2 printed as a part of the output? 

A. Zero 

B. Once 

C. Twice 

D. Thrice 

E. Compilation fails. 

Answer:

Q10. Given: 

What is the result? 

A. 2 4 6 8 

B. 2 4 6 8 9 

C. 1 3 5 7 

D. 1 3 5 7 9 

Answer: D

Q11. Given the following code: 

What will make this code compile and run? 

A. Change line 2 to the following: 

Public int price 

B. Change line 4 to the following: 

int price = new simple (); 

C. Change line 4 to the following: 

Float price = new simple (); 

D. Change line 5 to the following: 

Price = 4f; 

E. Change line 5 to the following: 

price.price = 4; 

F. Change line 5 to the following: 

Price = (float) 4: 

G. Change line 5 to the following: 

Price = (Simple) 4; 

H. The code compiles and runs properly; no changes are necessary 

Answer:

Q12. A method doSomething () that has no exception handling code is modified to trail a method that throws a checked exception. Which two modifications, made independently, will allow the program to compile? 

A. Catch the exception in the method doSomething(). 

B. Declare the exception to be thrown in the doSomething() method signature. 

C. Cast the exception to a RunTimeException in the doSomething() method. 

D. Catch the exception in the method that calls doSomething(). 

Answer: AB 

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

Q14. Given: 

What is the result? 

A. Red 0 

Orange 0 

Green 3 

B. Red 0 

Orange 0 

Green 6 

C. Red 0 

Orange 1 

D. Green 4 

E. Compilation fails 

Answer:

Q15. Which two statements are true for a two-dimensional array of primitive data type? 

A. It cannot contain elements of different types. 

B. The length of each dimension must be the same. 

C. At the 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: CD 

Q16. Given: 

What should statement1, statement2, and statement3, be respectively, in order to produce the result? 

Shape: constructor 

Square: foo 

Shape: foo 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer:

START 1Z0-803 EXAM