1z0-808 | 10 Tips For Regenerate 1z0-808 exam dumps


Q21. Given: 

public class TestOperator { 

public static void main(String[] args) { 

int result = 30 -12 / (2*5)+1; 

System.out.print("Result = " + result); 

What is the result? 

A. Result = 2 

B. Result = 3 

C. Result = 28 

D. Result = 29 

E. Result = 30 

Answer:

Q22. Given the code fragment: 

Which two modifications, when made independently, enable the code to print joe:true: 100.0? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer: A,C 

Q23. Given the code fragment: 

Which modification enables the code to print 54321? 

A. Replace line 6 with System, out. print (--x) ; 

B. At line 7, insert x --; 

C. Replace line 6 with --x; and, at line 7, insert system, out. print (x); 

D. Replace line 12 With return (x > 0) ? false: true; 

Answer:

Q24. Given: 

What is the result? 

A. Initialized Started 

B. Initialized Started Initialized 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

Q25. Given the code format: 

Which code fragment must be inserted at line 6 to enable the code to compile? 

A. DBConfiguration f; return f; 

B. Return DBConfiguration; 

C. Return new DBConfiguration; 

D. Retutn 0; 

Answer:

Q26. Given the code fragment: 

Which code fragment, when inserted at // insert code here, enables the code to compile and and print a b c? 

A. List update (String[] strs) 

B. Static ArrayListupdate(String [] strs) 

C. Static List update (String [] strs) 

D. Static void update (String[] strs) 

E. ArrayList static update(String [] strs) 

Answer:

Q27. Which usage represents a valid way of compiling java source file with the name "Main"? 

A. javac Main.java 

B. java Main.class 

C. java Main.java 

D. javac Main 

E. java Main 

Answer:

Explanation: The compiler is invoked by the javac command. When compiling a Java class, you must include the file name, which houses the main classes including the Java extension. So to run Main.java file we have to use command in option A. TO execute Java program we can use Java command but can't use it for compiling. https://docs.oracle.com/javase/tutorial/getStarted/application/index.html 

Q28. Which of the following exception will be thrown due to the statement given here? 

int array[] = new int[-2]; 

A. NullPointerException 

B. NegativeArraySizeException 

C. ArrayIndexOutOfBoundsException 

D. IndexOutOfBoundsException 

E. This statement does not cause any exception. 

Answer:

Explanation: 

In given statement we can see that, we have passed negative value for creating int array, 

which results a NegativeArraySize Except ion. Hence option B is correct. 

Option A is incorrect as it is thrown when an application attempts to use null in a case 

where an object is required. 

Option D is incorrect as IndexOutOfBoundsException thrown to indicate that an index of 

some sort (such as to an array, to a string, or to a vector) is out of range. 

REFERENCE 

rhttpy/docs.oracle.com/iavase/S/docs/api/java/lang/NegativeArraySizeException.html 

Q29. Given the following classes: 

Which two options fail to compile when placed at line n1 of the main method? 

A. employee.salary = 50_000; 

B. director.salary = 80_000; 

C. employee.budget = 200_000; 

D. manager.budget = 1_000_000; 

E. manager.stockOption = 500; 

F. director.stockOptions = 1_000; 

Answer: C,E 

Q30. Given the following class declarations: 

public abstract class Animal 

public interface Hunter 

public class Cat extends Animal implements Hunter 

public class Tiger extends Cat 

Which answer fails to compile? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer:

Explanation: Look at the right side of the declaration ArrayLIst() rather than ArrayList