It is more faster and easier to pass the Oracle java se 8 programmer i 1z0 808 exam by using Exact Oracle Java SE 8 Programmer I questuins and answers. Immediate access to the Down to date java se 8 programmer i 1z0 808 dumps Exam and find the same core area 1z0 808 book questions with professionally verified answers, then PASS your exam with a high score now.


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1z0-808 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1z0-808 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1z0-808-exam-dumps.html

Q71. 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 


Q72. Given the code fragment: 

What is the result if the integer aVar is 9? 

A. 10 Hello World! 

B. Hello Universe! 

C. Hello World! 

D. Compilation fails. 

Answer:


Q73. Given: 

class Base { 

// insert code here 

public class Derived extends Base{ 

public static void main(String[] args) { 

Derived obj = new Derived(); 

obj.setNum(3); 

System.out.println("Square = " + obj.getNum() * obj.getNum()); 

Which two options, when inserted independently inside class Base, ensure that the class is being properly encapsulated and allow the program to execute and print the square of the number? 

A. private int num; public int getNum() { return num; }public void setNum(int num) { this.num = num;} 

B. public int num; protected public int getNum() { return num; }protected public void setNum(int num) { this.num = num;} 

C. private int num;public int getNum() {return num;} private void setNum(int num) { this.num = num;} 

D. protected int num; public int getNum() { return num; } public void setNum(int num) { this.num = num;} 

E. protected int num; private int getNum() { return num; } public void setNum(int num) { this.num = num;} 

Answer: A,D 

Explanation: 

Incorrect: 

Not B: illegal combination of modifiers: protected and public 

not C: setNum method cannot be private. 

not E: getNum method cannot be private. 


Q74. Given the code fragment: 

String[] cartoons = {"tom","jerry","micky","tom"}; 

int counter =0; 

if ("tom".equals(cartoons[0])) { 

counter++; 

} else if ("tom".equals(cartoons[1])) { 

counter++; 

} else if ("tom".equals(cartoons[2])) { 

counter++; 

} else if ("tom".equals(cartoons[3])) { 

counter++; 

System.out.print(counter); 

What is the result? 

A. 1 

B. 2 

C. 4 

D. 0 

Answer:

Explanation: Counter++ will be executed only once because of the else if constructs. 


Q75. Given the code fragment: 

public class Test { 

static String[][] arr =new String[3][]; 

private static void doPrint() { 

//insert code here 

public static void main(String[] args) { 

String[] class1 = {"A","B","C"}; 

String[] class2 = {"L","M","N","O"}; 

String[] class3 = {"I","J"}; 

arr[0] = class1; 

arr[1] = class2; 

arr[2] = class3; 

Test.doPrint(); 

Which code fragment, when inserted at line //insert code here, enables the code to print 

COJ? 

A. int i = 0; 

for (String[] sub: arr) { 

int j = sub.length -1; 

for (String str: sub) { 

System.out.println(str[j]); 

i++; 

B. private static void doPrint() { 

for (int i = 0;i < arr.length;i++) { 

int j = arr[i].length-1; 

System.out.print(arr[i][j]); 

C. int i = 0; 

for (String[] sub: arr[][]) { 

int j = sub.length; 

System.out.print(arr[i][j]); 

i++; 

D. for (int i = 0;i < arr.length-1;i++) { 

int j = arr[i].length-1; 

System.out.print(arr[i][j]); 

i++; 

Answer:

Explanation: 

Incorrect: 

not A: The following line causes a compile error: 

System.out.println(str[j]); 

Not C: Compile erro line: 

for (String[] sub: arr[][]) 

not D: Output: C 


Q76. Given the code fragment: 

What is the result? 

A. 10 : 10 

B. 5 : 5 

C. 5 : 10 

D. Compilation fails 

Answer:


Q77. Given: 

What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q78. Given: 

public class ColorTest { 

public static void main(String[] args) { 

String[] colors = {"red", "blue","green","yellow","maroon","cyan"}; 

int count = 0; 

for (String c : colors) { 

if (count >= 4) { 

break; 

else { 

continue; 

if (c.length() >= 4) { 

colors[count] = c.substring(0,3); 

count++; 

System.out.println(colors[count]); 

What is the result? 

A. Yellow 

B. Maroon 

C. Compilation fails 

D. A StringIndexOutOfBoundsException is thrown at runtime. 

Answer:

Explanation: The line, if (c.length() >= 4) {, is never reached. This causes a compilation error. 

Note: The continue statement skips the current iteration of a for, while , or do-while loop. An unlabeled.break.statement terminates the innermost.switch,.for,.while, or.do-while.statement, but a labeled.break.terminates an outer statement. 


Q79. Given: 

public class Marklist { 

int num; 

public static void graceMarks(Marklist obj4) { 

obj4.num += 10; 

public static void main(String[] args) { 

MarkList obj1 = new MarkList(); 

MarkList obj2 = obj1; 

MarkList obj1 = null; 

obj2.num = 60; 

graceMarks(obj2); 

How many objects are created in the memory runtime? 

A. 1 

B. 2 

C. 3 

D. 4 

Answer:

Explanation: obj1 and obj3. 

when you do e2 = e1 you're copying object references - you're not making a copy of the object - and so the variables e1 and e2 will both point to the same object. 


Q80. Which three are advantages of the Java exception mechanism? 

A. Improves the program structure because the error handling code is separated from the normal program function 

B. Provides a set of standard exceptions that covers all the possible errors 

C. Improves the program structure because the programmer can choose where to handle exceptions 

D. Improves the program structure because exceptions must be handled in the method in which they occurred 

E. Allows the creation of new exceptions that are tailored to the particular program being created 

Answer: A,C,E