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

2021 Jun 1z0-808 free practice exam

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

A. abstract 

B. public 

C. default 

D. It will not compile with any as interfaces cannot have non abstract methods. 

E. It will compile without filling the blank. 

Answer: C 


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. https;//docs.oraclexom/javase/tutorial/java/Iandl/defaultmethods.html 

Q12. View the exhibit. 

Given the code fragment: 

Which change enables the code to print the following? 

James age: 20 

Williams age: 32 

A. Replacing line 5 with public static void main (String [] args) throws MissingInfoException, AgeOutofRangeException { 

B. Replacing line 5 with public static void main (String [] args) throws.Exception { 

C. Enclosing line 6 and line 7 within a try block and adding: catch(Exception e1) { //code goes here} catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here} 

D. Enclosing line 6 and line 7 within a try block and adding: catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here} 

Answer: C 

Q13. 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: C 

Q14. Given the code fragment: 

StringBuilder sb = new StringBuilder ( ) ; 

Sb.append (“world”); 

Which code fragment prints Hello World? 

A. sb.insert(0,"Hello "); 


B. sb.append(0,"Hello "); 


C. sb.add(0,"Hello "); 


D. sb.set(0,"Hello "); 


Answer: A 

Explanation: The java.lang.StringBuilder.insert(int offset, char c) method inserts the string representation of the char argument into this sequence. The second argument is inserted into the contents of this sequence at the position indicated by offset. The length of this sequence increases by one.The offset argument must be greater than or equal to 0, and less than or equal to the length of this sequence. 

Reference: Java.lang.StringBuilder.insert() Method 

Q15. Given: 

abstract class A1 { 

public abstract void m1(); 

public void m2() { System.out.println("Green"); } 

abstract class A2 extends A1 { 

public abstract void m3(); 

public void m1() { System.out.println("Cyan"); } 

public void m2() { System.out.println("Blue"); } 

public class A3 extends A2 { 

public void m1() { System.out.println("Yellow"); } 

public void m2() { System.out.println("Pink"); } 

public void m3() { System.out.println("Red"); } 

public static void main(String[] args) { 

A2 tp = new A3(); 




What is the result? 

A. Yellow Pink Red 

B. Cyan Blue Red 

C. Cyan Green Red 

D. Compilation Fails 

Answer: A

Up to date 1z0-808 study guide:

Q16. Given the code fragment: 

Which modification enables the code fragment to print TrueDone? 

A. Replace line 5 With String result = "true"; Replace line 7 with case "true": 

B. Replace line 5 with boolean opt = l; Replace line 7 with case 1= 

C. At line 9, remove the break statement. 

D. Remove the default section. 

Answer: A 

Q17. Given: 

public class Test { 

public static void main(String[] args) { 

int arr[] = new int[4]; 

arr[0] = 1; 

arr[1] = 2; 

arr[2] = 4; 

arr[3] = 5; 

int sum = 0; 

try { 

for (int pos = 0; pos <= 4; pos++) { 

sum = sum + arr[pos]; 

} catch (Exception e) { 

System.out.println("Invalid index"); 


What is the result? 

A. 12 

B. Invalid Index 

C. Invalid Index 

D. Compilation fails 

Answer: B 

Explanation: The loop ( for (int pos = 0; pos <= 4; pos++) { ), it should be pos <= 3, causes an exception, which is caught. Then the correct sum is printed. 

Q18. Given the fragments: 

Which line causes a compilation error? 

A. Line n1 

B. Line n2 

C. Line n3 

D. Line n4 

Answer: A 

Q19. Given the code fragment

Which code fragments, inserted independently, enable the code compile? 

A. t.fvar = 200; 

B. cvar = 400; 

C. fvar = 200; cvar = 400; 

D. this.fvar = 200; this.cvar = 400; 

E. t.fvar = 200; Test2.cvar = 400; 

F. this.fvar = 200; Test2.cvar = 400; 

Answer: B 

Q20. Given the code fragment: 

What could expression1 and expression2 be, respectively, in order to produce output –8, 16? 

A. + +a, - -b 

B. + +a, b- -

C. A+ +, - - b 

D. A + +, b - -

Answer: D