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. Which of the following can fill in the blank in this code to make it compile? 

A. abstract 

B. final 

C. private 

D. default 

E. int 

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. httpsy/docs.oracle.com/javase/tutorial/iava/landl/defaultmethods.html 

Q2. Given the code fragment: 

Which code fragment, when inserted at line n1, enables the App class to print Equal? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q3. View the exhibit: 

public class Student { 

public String name = ""; 

public int age = 0; 

public String major = "Undeclared"; 

public boolean fulltime = true; 

public void display() { 

System.out.println("Name: " + name + " Major: " + major); } 

public boolean isFullTime() { 

return fulltime; 

Which line of code initializes a student instance? 

A. Student student1; 

B. Student student1 = Student.new(); 

C. Student student1 = new Student(); 

D. Student student1 = Student(); 

Answer:

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

Q5. Given the code fragment: 

public class Test { 

public static void main(String[] args) { 

boolean isChecked = false; 

int arry[] = {1,3,5,7,8,9}; 

int index = arry.length; 

while ( <code1> ) { 

if (arry[index-1] % 2 ==0) { 

isChecked = true; 

<code2> 

System.out.print(arry(index]+", "+isChecked)); 

Which set of changes enable the code to print 1, true? 

A. Replacing <code1> with index > 0 and replacing <code2> with index--; 

B. Replacing <code1> with index > 0 and replacing <code2> with --index; 

C. Replacing <code1> with index > 5 and replacing <code2> with --index ; 

D. Replacing <code1> with index and replacing <code2> with --index ; 

Answer:

Explanation: 

Note: Code in B (code2 is --index;). also works fine. 

Q6. Given the code fragment: 

float x = 22.00f % 3.00f; 

int y = 22 % 3; 

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

What is the result? 

A. 1.0, 1 

B. 1.0f, 1 

C. 7.33, 7 

D. Compilation fails 

E. An exception is thrown at runtime 

Answer:

Q7. Given: 

What is the result? 

A. 10 : 22 : 20 

B. 10 : 22 : 22 

C. 10 : 22 : 6 

D. 10 : 30 : 6 

Answer:

Q8. Given the code fragment: 

Which three code fragments can be independently inserted at line nl to enable the code to print one? 

A. Byte x = 1; 

B. short x = 1; 

C. String x = "1"; 

D. Long x = 1; 

E. Double x = 1; 

F. Integer x = new Integer ("1"); 

Answer: A,B,F 

Q9. Given: 

public class Test { 

public static void main(String[] args) { 

try { 

String[] arr =new String[4]; 

arr[1] = "Unix"; 

arr[2] = "Linux"; 

arr[3] = "Solarios"; 

for (String var : arr) { 

System.out.print(var + " "); 

} catch(Exception e) { 

System.out.print (e.getClass()); 

What is the result? 

A. Unix Linux Solaris 

B. Null Unix Linux Solaris 

C. Class java.lang.Exception 

D. Class java.lang.NullPointerException 

Answer:

Explanation: null Unix Linux Solarios 

The first element, arr[0], has not been defined. 

Q10. Given: 

What is the result? 

A. Initialized Started 

B. Initialized Started Initialized 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer: