aiotestking uk

1z0-808 Exam Questions - Online Test


1z0-808 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. Given: 

public class App { // Insert code here System.out.print("Welcome to the world of Java"); } } 

Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen? 

A. static public void main (String [] args) { 

B. static void main (String [] args) { 

C. public static void Main (String [] args) { 

D. public static void main (String [] args) { 

E. public void main (String [] args) { 

Answer: A,D 

Explanation: 

Incorrect: 

Not B: No main class found. 

Not C: Main method not found 

not E: Main method is not static. 

Q2. Given: 

The class is poorly encapsulated. You need to change the circle class to compute and return the area instead. 

Which two modifications are necessary to ensure that the class is being properly encapsulated? 

A. Remove the area field. 

B. Change the getArea( ) method as follows: 

public double getArea ( ) { return Match.PI * radius * radius; } 

C. Add the following method: 

public double getArea ( ) {area = Match.PI * radius * radius; } 

D. Change the cacess modifier of the SerRadius ( ) method to be protected. 

Answer: B,D 

Q3. Given the following code: 

What are the values of each element in intArr after this code has executed? 

A. 15, 60, 45, 90, 75 

B. 15, 90, 45, 90, 75 

C. 15, 30, 75, 60, 90 

D. 15, 30, 90, 60, 90 

E. 15, 4, 45, 60, 90 

Answer:

Q4. Given: 

What is the result? 

A. 2 4 6 8 10 12 

B. 2 4 6 8 10 12 14 

C. Compilation fails 

D. The program prints multiple of 2 infinite times 

E. The program prints nothing 

Answer:

Q5. Given: 

public class TestOperator { 

public static void main(String[] args) { 

int result = 30 -12 / (2*5)+1; 

System.out.print("Result = " + result); 

What is the result? 

A. Result = 2 

B. Result = 3 

C. Result = 28 

D. Result = 29 

E. Result = 30 

Answer:

Q6. Given: 

abstract class A1 { 

public abstract void m1(); 

public void m2() { System.out.println("Green"); } 

abstract class A2 extends A1 { 

public abstract void m3(); 

public void m1() { System.out.println("Cyan"); } 

public void m2() { System.out.println("Blue"); } 

public class A3 extends A2 { 

public void m1() { System.out.println("Yellow"); } 

public void m2() { System.out.println("Pink"); } 

public void m3() { System.out.println("Red"); } 

public static void main(String[] args) { 

A2 tp = new A3(); 

tp.m1(); 

tp.m2(); 

tp.m3(); 

What is the result? 

A. Yellow Pink Red 

B. Cyan Blue Red 

C. Cyan Green Red 

D. Compilation Fails 

Answer:

Q7. Given: 

What is the result? 

A. 200.0 : 100.0 

B. 400.0 : 200.0 

C. 400.0 : 100.0 

D. Compilation fails. 

Answer:

Q8. Given the code fragment: 

System.out.println(2 + 4 * 9 - 3); //Line 21 

System.out.println((2 + 4) * 9 - 3); // Line 22 

System.out.println(2 + (4 * 9) - 3); // Line 23 

System.out.println(2 + 4 * (9 - 3)); // Line 24 

System.out.println((2 + 4 * 9) - 3); // Line 25 

Which line of codes prints the highest number? 

A. Line 21 

B. Line 22 

C. Line 23 

D. Line 24 

E. Line 25 

Answer:

Explanation: The following is printed: 35 51 

35 

26 

35 

Q9. Given the following main method: 

What is the result? 

A. 5 4 3 2 1 0 

B. 5 4 3 2 1 

C. 4 2 1 

D. 5 

E. Nothing is printed 

Answer:

Explanation: 

Loop will run only once and after that num == 0 will break it After first cycle of the loop. 

Q10. Given: 

What is the result? 

A. The program prints nothing 

B. d 

C. A StringIndexOutOfBoundsException is thrown at runtime. 

D. AnArrayIndexOutOfBoundsException is thrown at runtime. 

E. A NullPointerException is thrown at runtime. 

Answer: