1z0-808 | The Up to the immediate present Guide To 1z0-808 exam question


Q111. Given: 

Which two classes use the shape class correctly? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

F. Option F 

Answer: B,E 

Explanation: When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class (E). However, if it does not, then the subclass must also be declared abstract (B). Note: An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. 

Q112. Given: 

public class TestLoop1 { 

public static void main(String[] args) { 

int a = 0, z=10; 

while (a < z) { 

a++; 

--z; 

} System.out.print(a + " : " + z); } } 

What is the result? 

A. 5 : 5 

B. 6 : 4 

C. 6 : 5 

D. 5 : 4 

Answer:

Q113. Given: 

What is the result? 

A. The sum is 2 

B. The sum is 14 

C. The sum is 15 

D. The loop executes infinite times 

E. Compilation fails 

Answer:

Q114. Given: 

Which statement is true? 

A. Both p and s are accessible by obj. 

B. Only s is accessible by obj. 

C. Both r and s are accessible by obj. 

D. p, r, and s are accessible by obj. 

Answer:

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

Q116. Given the code fragment: 

public class ForTest { 

public static void main(String[] args) { 

int[] array = {1, 2, 3}; 

for ( foo ) { 

Which three code fragments, when replaced individually for foo, enables the program to compile? 

A. int i : array 

B. int i = 0; i < 1; 

C. ; ; 

D. ; i < 1; i++ 

E. i = 0; i<1; 

Answer: A,B,C 

Q117. Given: 

What is the result? 

A. C B A 

B. C 

C. A B C 

D. Compilation fails at line n1 and line n2 

Answer:

Q118. Given the code fragment: 

What is the result? 

A. 28false29 true 

B. 285 < 429 true 

C. true true 

D. compilation fails 

Answer:

Q119. Given: 

public class FieldInit { 

char c; 

boolean b; 

float f; 

void printAll() { 

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

System.out.println("c = " + b); 

System.out.println("c = " + f); 

public static void main(String[] args) { 

FieldInit f = new FieldInit(); 

f.printAll(); 

What is the result? 

A. c = null 

b = false 

f = 0.0F 

B. c = 0 

b = false 

f = 0.0f 

C. c = null 

b = true 

f = 0.0 

D. c = 

b = false 

f = 0.0 

Answer:

Q120. Consider following interface. 

Which of the following will create instance of Runnable type? 

A. Runnable run = 0 -> {System.out.println("Run");} 

B. Runnable run = 0 -> System.outprintlnfRun"); 

C. Runnable run = 0 > System.outprintlnfRun"); 

D. Runnable run = > System.ouLprintlnfRun"}; 

E. None of the above. 

Answer:

Explanation: 

Option A is the correct answer. 

To create we have used following method with LocalDate class; 

public static LocalDate of(intyear, int month, intdayOfMonth) 

Here we need to remember that month is not zero based so if you pass 1 for month, then 

month will be January. 

Then we have used period object of 1 day and add to date object which makes current date 

to next day, so final output is 2015-03-27. Hence option A is correct.