Want to know Examcollection 1z0-808 Exam practice test features? Want to lear more about Oracle Java SE 8 Programmer I certification experience? Study Approved Oracle 1z0-808 answers to Leading 1z0-808 questions at Examcollection. Gat a success with an absolute guarantee to pass Oracle 1z0-808 (Java SE 8 Programmer I) test on your first attempt.

2017 Mar 1z0-808 exam answers

Q41. Given the code fragment: 

Which option represents the state of the num array after successful completion of the outer loop? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q42. Given the following two classes: 

How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate? 

Any amount of electricity used by a customer (represented by an instance of the customer class) must contribute to the customer's bill (represented by the member variable bill) through the method useElectricity method. An instance of the customer class should never be able to tamper with or decrease the value of the member variable bill. 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q43. Given the code fragment: 

Which two modifications should you make so that the code compiles successfully? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer: A,C 

Explanation: 

Add throws clause in both printFileContent and main. 


Q44. Given: class Base { 

public static void main(String[] args) { 

System.out.println("Base " + args[2]); 

public class Sub extends Base{ 

public static void main(String[] args) { 

System.out.println("Overriden " + args[1]); 

And the commands: 

javac Sub.java 

java Sub 10 20 30 

What is the result? 

A. Base 30 

B. Overridden 20 

C. Overridden 20 Base 30 

D. Base 30 Overridden 20 

Answer:


Q45. Given the code fragment: 

What is the result? 

A. 10 8 6 4 2 0 

B. 10 8 6 4 2 

C. AnArithmeticException is thrown at runtime 

D. The program goes into an infinite loop outputting: 10 8 6 4 2 0. . . 

E. Compilation fails 

Answer:


Improve 1z0-808 exam engine:

Q46. Given the code fragment: 

int b = 3; 

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:


Q47. The protected modifier on a Field declaration within a public class means that the field ______________. 

A. Cannot be modified 

B. Can be read but not written from outside the class 

C. Can be read and written from this class and its subclasses only within the same package 

D. Can be read and written from this class and its subclasses defined in any package 

Answer:

Reference: 

http://beginnersbook.com/2013/05/java-access-modifiers/ 


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


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

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 


Q50. Given the code fragment? 

public class Test { 

public static void main(String[] args) { 

Test t = new Test(); 

int[] arr = new int[10]; 

arr = t.subArray(arr,0,2); 

// insert code here 

Which method can be inserted at line // insert code here to enable the code to compile? 

A. public int[] subArray(int[] src, int start, int end) { 

return src; 

B. public int subArray(int src, int start, int end) { 

return src; 

C. public int[] subArray(int src, int start, int end) { 

return src; 

D. public int subArray(int[] src, int start, int end) { 

return src; 

Answer: