Proper study guides for Refresh Oracle Java SE 8 Programmer I certified begins with Oracle 1z0-808 preparation products which designed to deliver the Pinpoint 1z0-808 questions by making you pass the 1z0-808 test at your first time. Try the free 1z0-808 demo right now.

2016 Aug 1z0-808 test question

Q41. Given: 


What is the result? 

A. 10 : 22 : 20 

B. 10 : 22 : 22 

C. 10 : 22 : 6 

D. 10 : 30 : 6 

Answer: B 


Q42. Given: 


Which is true? 

A. Sum for 0 to 0 = 55 

B. Sum for 0 to 10 = 55 

C. Compilation fails due to error on line 6. 

D. Compilation fails due to error on line 7. 

E. An Exception is thrown at the runtime. 

Answer: D 

Explanation: 

Loop variables scope limited to that enclosing loop. So in this case, the scope of the loop variable x declared at line 5, limited to that for loop. Trying to access that variable at line 7, which is out of scope of the variable x, causes a compile time error. So compilation fails 

due to error at line 7. Hence option D is correct. 

Options A and B are incorrect, since code fails to compile. 

Reference: httpsy/docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html 


Q43. Given: 


What is the result? 

A. Marrown 

String out of limits 

JesOran 

B. Marrown 

String out of limits 

Array out of limits 

C. Marrown 

String out of limits 

D. Marrown 

NanRed 

JesOran 

Answer: A 


Q44. Which of the following can fill in the blank in this code to make it compile? 


A. abstract 

B. final 

C. private 

D. default 

E. int 

Answer: C 

Explanation: 

From Java SE 8, we can use static and/or default methods in interfaces, but they should be non abstract methods. SO in this case using default in blank is completely legal. Hence option C is correct. Option A is incorrect as given method is not abstract, so can't use abstract there. Options B and E are incorrect as we can't have non abstract method interface if they are not default or static. httpsy/docs.oracle.com/javase/tutorial/iava/landl/defaultmethods.html 


Q45. Given the code fragment: 


Which two modifications, when made independently, enable the code to print joe:true: 100.0? 


A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer: A,C 


certifyforall.com

Up to the minute 1z0-808 actual exam:

Q46. Given: 

public class ScopeTest { 

int j, int k; 

public static void main(String[] args) { 

ew ScopeTest().doStuff(); } 

void doStuff() { 

nt x = 5; 

oStuff2(); 

System.out.println("x"); 

void doStuff2() { 

nt y = 7; 

ystem.out.println("y"); 

or (int z = 0; z < 5; z++) { 

ystem.out.println("z"); 

ystem.out.println("y"); 

Which two items are fields? 

A. j 

B. k 

C. x 

D. y 

E. z 

Answer: A,B 


Q47. Consider 

Integer number = Integer.valueOff 808.1"); 

Which is true about the above statement? 

A. The value of the variable number will be 808.1 

B. The value of the variable number will be 808 

C. The value of the variable number will be 0. 

D. A NumberFormatException will be throw. 

E. It will not compile. 

Answer: D 

Explanation: 

The Integer class value of 0 returns an Integer from given string. But we need to pass string which has correct format for integer otherwise it will throw a NumberFormatException. In this case we have passed string which is not an integer value (since what we passed is fractional number), so option D is correct. 


Q48. Given the code fragment: 


What is the result? 

A. 2 4 

B. 0 2 4 6 

C. 0 2 4 

D. Compilation fails 

Answer: C 


Q49. Which of the following data types will allow the following code snippet to compile? 


A. long 

B. double 

C. int 

D. float 

E. byte 

Answer: B,D 

Explanation: 

Option B and D are the correct answer. 

Since the variables I and j are floats, resultant will be float type too. So we have to use float 

or primitive type which can hold float, such a primitive type is double, it has wider range 

and also can hold floating point numbers, hence we can use double or float for the blank. 

As explained above options B and D are correct. 

long and int can't be used with floating point numbers so option A is incorrect. 

Option E is incorrect as it have smaller range and also can't be used with floating point 

numbers. 

hnpsy/docs.oracle.com/javase/tutorial/java/javaOO/variables.html 


Q50. public class StringReplace { 

public static void main(String[] args) { 

String message = "Hi everyone!"; 

System.out.println("message = " + message.replace("e", "X")); } 

What is the result? 

A. message = Hi everyone! 

B. message = Hi XvXryonX! 

C. A compile time error is produced. 

D. A runtime error is produced. 

E. message = 

F. message = Hi Xveryone! 

Answer: B