1z0-808 | Avant-garde Oracle 1z0-808 examcollection


Q101. Given: 

public class Test { 

public static void main(String[] args) { 

int ax = 10, az = 30; 

int aw = 1, ay = 1; 

try { 

aw = ax % 2; 

ay = az / aw; 

} catch (ArithmeticException e1) { 

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

} catch (Exception e2) { 

aw = 1; 

System.out.println("Divisor Changed"); 

ay = az /aw; // Line 14 

System.out.println("Succesful Division " + ay); 

What is the result? 

A. Invalid Divisor 

Divisor Changed 

Successful Division 30 

B. Invalid Divisor 

Successful Division 30 

C. Invalid Divisor 

Exception in thread "main" java.lang.ArithmeticException: / by zero 

at test.Teagle.main(Teagle.java:14) 

D. Invalid Divisor 

Exception in thread "main" java.lang.ArithmeticException: / by zero 

at test.Teagle.main(Teagle.java:14) 

Successful Division 1 

Answer:

Q102. Given: 

Which code fragment, when inserted at line 14, enables the code to print Mike Found? 

A. int f = ps.indexOf {new patient (“Mike”)}; 

B. int f = ps.indexOf (patient(“Mike”)); 

C. patient p = new Patient (“Mike”); int f = pas.indexOf(P) 

D. int f = ps.indexOf(p2); 

Answer:

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

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

Q104. Given: 

What is the result? 

A. myStr: 9009, myNum: 9009 

B. myStr: 7007, myNum: 7007 

C. myStr: 7007, myNum: 9009 

D. Compilation fails 

Answer:

Q105. Given: 

What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q106. A method is declared to take three arguments. A program calls this method and passes only two arguments. What is the results? 

A. Compilation fails. 

B. The third argument is given the value null. 

C. The third argument is given the value void. 

D. The third argument is given the value zero. 

E. The third argument is given the appropriate falsy value for its declared type. F) An 

exception occurs when the method attempts to access the third argument. 

Answer:

Q107. Given: 

A. a, e 

i, o 

B. a, e 

o, o 

C. e, e 

I, o 

D. e, e 

o, o 

Answer:

Q108. Given the code fragment: 

class Student { 

int rollnumber; 

String name; 

List cources = new ArrayList(); 

// insert code here 

public String toString() { 

return rollnumber + " : " + name + " : " + cources; 

And, 

public class Test { 

public static void main(String[] args) { 

List cs = newArrayList(); 

cs.add("Java"); 

cs.add("C"); 

Student s = new Student(123,"Fred", cs); 

System.out.println(s); 

Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]? 

A. 

private Student(int i, String name, List cs) { 

/* initialization code goes here */ 

B. 

public void Student(int i, String name, List cs) { 

/* initialization code goes here */ 

C. 

Student(int i, String name, List cs) { 

/* initialization code goes here */ 

D. 

Student(int i, String name, ArrayList cs) { 

/* initialization code goes here */ 

Answer:

Explanation: 

Incorrect: 

Not A: Student has private access line: Student s = new Student(123,"Fred", cs); 

Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs); 

Q109. Given: 

A. X XX 

B. X Y X 

C. Y Y X 

D. Y YY 

Answer:

Q110. Given the code fragment: 

What is the result? 

A. A B C 

B. A B C D E 

C. A B D E 

D. Compilation fails. 

Answer: