Exam Code: 1z0-808 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: Java SE 8 Programmer I
Certification Provider: Oracle
Free Today! Guaranteed Training- Pass 1z0-808 Exam.

2016 Jul 1z0-808 exam question

Q151. Which of the following will print current time? 

A. System.out.print(new LocalTime()-now0); 

B. System.out.print(new LocalTime()); 

C. System.ouLprint(LocalTime.now()); 

D. System.ouLprint(LocalTime.today()); 

E. None of the above. 

Answer: C 


The LocalTime is an interface, so we can't use new keyword with them. So options A and C are incorrect. To get current time we can call now method on LocalTime interface. So option C is correct. Option D is incorrect as there is no method called today as in LocalTime interface 


Q152. Given the code from the Greeting.Java file: 

Which set of commands prints Hello Duke in the console? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: C 

Q153. Given the code fragment: 

What is the result? 

A. Jesse 25 Walter 52 

B. Compilation fails only at line n1 

C. Compilation fails only at line n2 

D. Compilation fails at both line n1 and line n2 

Answer: D 

Q154. Given: 

What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B 

Q155. Given: 

What is the output? 

A. [21, 13, 11] 

B. [30] 

C. [] 

D. Compilation fails due to error at line 7 

E. Compilation tails due to error at line 10 

Answer: D 


Option D is the correct answer. 

Code fails to compile as we can't use primitive for collections type, so in this code trying to 

use int at line 7, causes a compile error. We should have use wrapper. Integer there. So 

option D is correct. 



Improve 1z0-808 test question:

Q156. Given: 

public class TestLoop1 { 

public static void main(String[] args) { 

int a = 0, z=10; 

while (a < z) { 



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

What is the result? 

A. 5 : 5 

B. 6 : 4 

C. 6 : 5 

D. 5 : 4 

Answer: A 

Q157. Given: 

What is the result? 

A. true:true 

B. true:false 

C. false:true 

D. false:false 

Answer: C 

Q158. Given: 

public class ComputeSum { 

public int x; 

public int y; 

public int sum; 

public ComputeSum (int nx, int ny) { 

x = nx; y =ny; 


public void setX(int nx) { x = nx; updateSum();} 

public void setY(int ny) { x = ny; updateSum();} 

void updateSum() { sum = x + y;} 

This class needs to protect an invariant on the sum field. 

Which three members must have the private access modifier to ensure that this invariant is maintained? 

A. The x field 

B. The y field 

C. The sum field 

D. The ComputerSum ( ) constructor 

E. The setX ( ) method 

F. The setY ( ) method 

Answer: C,E,F 

Explanation: The sum field and the two methods (setX and SetY) that updates the sum field. 

Q159. Given the code fragment: 

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

int count = 0; 

for (int jj = 3; jj > 0; jj--) { 

if (ii == jj) { 



System.out.print(count); continue; } 

What is the result? 

A. 011 

B. 012 

C. 123 

D. 000 

Answer: A 

Q160. Given the code fragment: 

public class Test { 

public static void main(String[] args) { 

boolean isChecked = false; 

int arry[] = {1,3,5,7,8,9}; 

int index = arry.length; 

while ( <code1> ) { 

if (arry[index-1] % 2 ==0) { 

isChecked = true; 


System.out.print(arry(index]+", "+isChecked)); 

Which set of changes enable the code to print 1, true? 

A. Replacing <code1> with index > 0 and replacing <code2> with index--; 

B. Replacing <code1> with index > 0 and replacing <code2> with --index; 

C. Replacing <code1> with index > 5 and replacing <code2> with --index ; 

D. Replacing <code1> with index and replacing <code2> with --index ; 

Answer: A 


Note: Code in B (code2 is --index;). also works fine.