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


Q81. Which two actions will improve the encapsulation of a class? 

A. Changing the access modifier of a field from public to private 

B. Removing the public modifier from a class declaration 

C. Changing the return type of a method to void 

D. Returning a copy of the contents of an array or ArrayList instead of a direct reference 

Answer: A,D 

Reference: http://www.tutorialspoint.com/java/java_access_modifiers.htm 

Q82. Given: 

What is the result? 

A. Null 

B. Compilation fails 

C. An exception is thrown at runtime 

D. 0 

Answer:

Q83. Given: 

What is the result? 

A. 10 : 22 : 20 

B. 10 : 22 : 22 

C. 10 : 22 : 6 

D. 10 : 30 : 6 

Answer:

Q84. Given the code fragment: 

What is the result? 

A. true true 

B. true false 

C. false false 

D. false true 

Answer:

Q85. Given: 

Class A { } 

Class B { } 

Interface X { } 

Interface Y { } 

Which two definitions of class C are valid? 

A. Class C extends A implements X { } 

B. Class C implements Y extends B { } 

C. Class C extends A, B { } 

D. Class C implements X, Y extends B { } 

E. Class C extends B implements X, Y { } 

Answer: A,E 

Explanation: extends is for extending a class. 

implements is for implementing an interface. Java allows for a class to implement many interfaces. 

Q86. Given: 

What is the output? 

A. 1Z0 

B. 1Z0-808 

C. An exception will be thrown. 

D. Compilation fails due to error at line 3. 

E. Compilation tails due to error at line 4. 

Answer:

Explanation: 

Option E is the correct answer. Code fails to compile because there is no method called concert in StringBuilder class. The concert method is in String class. Hence option E is correct Here we should have used append method of StringBuilder class, in that case option B would be correct. https://docs.oracle.com/javase/tutorial/java/data/buffers.html 

Q87. Given: 

public class TestField { 

int x; 

int y; 

public void doStuff(int x, int y) { 

this.x = x; 

y =this.y; 

public void display() { 

System.out.print(x + " " + y + " : "); 

public static void main(String[] args) { 

TestField m1 = new TestField(); 

m1.x = 100; 

m1.y = 200; 

TestField m2 = new TestField(); 

m2.doStuff(m1.x, m1.y); 

m1.display(); 

m2.display(); 

What is the result? 

A. 100 200 : 100 200 

B. 100 0 : 100 0 : 

C. 100 200 : 100 0 : 

D. 100 0 : 100 200 : 

Answer:

Q88. Given: 

What is the result? 

A. simaple A 

B. Capital A 

C. simaple A default Capital A 

D. simaple A default 

E. Compilation fails. 

Answer:

Explanation: 

Here we have to use two ternary operators combined. SO first we can use to check first 

condition which is x > 10, as follows; 

x>10?">": (when condition false) Now we have to use another to check if x<10 as follows; 

x<10?V:"=" We can combine these two by putting last ternary statement in the false 

position of first ternary statement as follows; 

x>10?">":x<10?'<':"=" 

https;//docs.oraclexom/javase/tutorial/java/nutsandbolts/if.html 

Q89. Given: 

public class App { // Insert code here System.out.print("Welcome to the world of Java"); } } 

Which two code fragments, when inserted independently at line // Insert code here, enable the program to execute and print the welcome message on the screen? 

A. static public void main (String [] args) { 

B. static void main (String [] args) { 

C. public static void Main (String [] args) { 

D. public static void main (String [] args) { 

E. public void main (String [] args) { 

Answer: A,D 

Explanation: 

Incorrect: 

Not B: No main class found. 

Not C: Main method not found 

not E: Main method is not static. 

Q90. Given the code fragment: 

A. Super Sub Sub 

B. Contract Contract Super 

C. Compilation fails at line n1 

D. Compilation fails at line n2 

Answer: