aiotestking uk

1z0-808 Exam Questions - Online Test


1z0-808 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. Given: 

A. X XX 

B. X Y X 

C. Y Y X 

D. Y YY 

Answer:

Q2. Given: 

What is result? 

A. Successful 

B. Unsuccessful 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

Q3. Consider following method 

Which statement is true? 

A. This method is invalid. 

B. This method can be used only in an interface. 

C. This method can return anything. 

D. This method can be used only in an interface or an abstract class. 

E. None of above. 

Answer:

Explanation: 

Given method is declared as default method so we can use it only inside an interface. 

Hence option B is correct and option D is incorrect. 

Option A is incorrect as it is valid method. Option C is incorrect as return type is void, which 

means we can't return anything. 

Q4. public class ForTest { 

public static void main(String[] args) { 

int[] arrar = {1,2,3}; 

for ( foo ) { 

Which three are valid replacements for foo so that the program will compiled and run? 

A. int i: array 

B. int i = 0; i < 1; i++ 

C. ;; 

D. ; i < 1; i++ 

E. ; i < 1; 

Answer: A,B,C 

Q5. Given: 

How many objects have been created when the line / / do complex stuff is reached? 

A. Two 

B. Three 

C. Four 

D. Six 

Answer:

Q6. Which two items can legally be contained within a java class declaration? 

A. An import statement 

B. A field declaration 

C. A package declaration 

D. A method declaration 

Answer: B,D 

Reference: 

http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html 

Q7. Given: 

public class Painting { 

private String type; 

public String getType() { 

return type; 

public void setType(String type) { 

this.type = type; 

public static void main(String[] args) { 

Painting obj1 = new Painting(); 

Painting obj2 = new Painting(); 

obj1.setType(null); 

obj2.setType("Fresco"); 

System.out.print(obj1.getType() + " : " + obj2.getType()); 

What is the result? 

A. : Fresco 

B. null : Fresco 

C. Fresco : Fresco 

D. A NullPointerException is thrown at runtime 

Answer:

Q8. Given: 

class Sports { 

int num_players; 

String name, ground_condition; 

Sports(int np, String sname, String sground){ 

num_players = np; 

name = sname; 

ground_condition = sground; 

class Cricket extends Sports { 

int num_umpires; 

int num_substitutes; 

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

A. Cricket() { 

super(11, "Cricket", "Condidtion OK"); 

num_umpires =3; 

num_substitutes=2; 

B. Cricket() { 

super.ground_condition = "Condition OK"; 

super.name="Cricket"; 

super.num_players = 11; 

num_umpires =3; 

num_substitutes=2; 

C. Cricket() { 

this(3,2); 

super(11, "Cricket", "Condidtion OK"); 

Cricket(int nu, ns) { 

this.num_umpires =nu; 

this.num_substitutes=ns; 

D. Cricket() { 

this.num_umpires =3; 

this.num_substitutes=2; 

super(11, "Cricket", "Condidtion OK"); 

Answer:

Explanation: 

Incorrect: 

not C, not D: call to super must be the first statement in constructor. 

Q9. Given the code fragments: 

Which code fragment, when inserted at line ni, enables the code to print Hank? 

A. checkAge (iList, ( ) -> p. get Age ( ) > 40); 

B. checkAge(iList, Person p -> p.getAge( ) > 40); 

C. checkAge (iList, p -> p.getAge ( ) > 40); 

D. checkAge(iList, (Person p) -> { p.getAge() > 40; }); 

Answer:

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