Want to know Examcollection 1z0-808 Exam practice test features? Want to lear more about Oracle Java SE 8 Programmer I certification experience? Study Guaranteed Oracle 1z0-808 answers to Renew 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.

2016 Jul 1z0-808 practice exam

Q61. Given: 


What is the result? 

A. 11, 21, 31, 11, 21, 31 

B. 11, 21, 31, 12, 22, 32 

C. 12, 22, 32, 12, 22, 32 

D. 10, 20, 30, 10, 20, 30 

Answer: D 


Q62. Given: 

package p1; 

public interface DoInterface { 

void method1(int n1); // line n1 

package p3; 

import p1.DoInterface; 

public class DoClass implements DoInterface { 

public DoClass(int p1) { } 

public void method1(int p1) { } // line n2 

private void method2(int p1) { } // line n3 

public class Test { 

public static void main(String[] args) { 

DoInterface doi= new DoClass(100); // line n4 

doi.method1(100); 

doi.method2(100); 

Which change will enable the code to compile? 

A. Adding the public modifier to the declaration of method1 at line n1 

B. Removing the public modifier from the definition of method1 at line n2 

C. Changing the private modifier on the declaration of method 2 public at line n3 

D. Changing the line n4 DoClass doi = new DoClass ( ); 

Answer: C 

Explanation: Private members (both fields and methods) are only accessible inside the class they are declared or inside inner classes. private keyword is one of four access modifier provided by Java and its a most restrictive among all four e.g. public, default(package), protected and private. 

Read more: http://javarevisited.blogspot.com/2012/03/private-in-java-why-should-you-always.html#ixzz3Sh3mOc4D 


Q63. You are developing a banking module. You have developed a class named ccMask that has a maskcc method. 

Given the code fragment:


You must ensure that the maskcc method returns a string that hides all digits of the credit card number except the four last digits (and the hyphens that separate each group of four digits). 

Which two code fragments should you use at line n1, independently, to achieve this requirement? 


A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B,C 


Q64. Given: 

public class ColorTest { 

public static void main(String[] args) { 

String[] colors = {"red", "blue","green","yellow","maroon","cyan"}; 

int count = 0; 

for (String c : colors) { 

if (count >= 4) { 

break; 

else { 

continue; 

if (c.length() >= 4) { 

colors[count] = c.substring(0,3); 

count++; 

System.out.println(colors[count]); 

What is the result? 

A. Yellow 

B. Maroon 

C. Compilation fails 

D. A StringIndexOutOfBoundsException is thrown at runtime. 

Answer: C 

Explanation: The line, if (c.length() >= 4) {, is never reached. This causes a compilation error. 

Note: The continue statement skips the current iteration of a for, while , or do-while loop. An unlabeled.break.statement terminates the innermost.switch,.for,.while, or.do-while.statement, but a labeled.break.terminates an outer statement. 


Q65. Given the fragments: 


Which line causes a compilation error? 

A. Line n1 

B. Line n2 

C. Line n3 

D. Line n4 

Answer: A 


1z0-808  practice test

Leading 1z0-808 exams:

Q66. Given: 


What is the result? 

A. 1 

B. 1 

C. 2 

D. Compilation fails 

E. The loop executes infinite times 

Answer: E 


Q67. Which three are advantages of the Java exception mechanism? 

A. Improves the program structure because the error handling code is separated from the normal program function 

B. Provides a set of standard exceptions that covers all the possible errors 

C. Improves the program structure because the programmer can choose where to handle exceptions 

D. Improves the program structure because exceptions must be handled in the method in which they occurred 

E. Allows the creation of new exceptions that are tailored to the particular program being created 

Answer: A,C,E 


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


Q69. Given: 


What is the result? 

A. 10:20 

B. 0:20 

C. Compilation fails at line n1 

D. Compilation fails at line n2 

Answer: D 


Q70. Which two are valid array declaration? 

A. Object array[]; 

B. Boolean array[3]; 

C. int[] array; 

D. Float[2] array; 

Answer: A,C