Vcehome > Oracle > Oracle Java > 1Z0-808 > 1Z0-808 Online Practice Questions and Answers

1Z0-808 Online Practice Questions and Answers

Questions 4

Given the code fragment?

public class Test {

public static void main(String[] args) {

Test t = new Test();

int[] arr = new int[10];

arr = t.subArray(arr,0,2);

}

// insert code here

}

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

A. public int[] subArray(int[] src, int start, int end) { return src; }

B. public int subArray(int src, int start, int end) { return src; }

C. public int[] subArray(int src, int start, int end) { return src; }

D. public int subArray(int[] src, int start, int end) { return src; }

Browse 385 Q&As
Questions 5

Given the code fragment:

Which three lines fail to compile?

A. Line 7

B. Line 8

C. Line 9

D. Line 10

E. Line 11

F. Line 12

Browse 385 Q&As
Questions 6

Which two statements are true for a two-dimensional array?

A. It is implemented as an array of the specified element type.

B. Using a row by column convention, each row of a two-dimensional array must be of the same size.

C. At declaration time, the number of elements of the array in each dimension must be specified.

D. All methods of the class Object may be invoked on the two-dimensional array.

Browse 385 Q&As
Questions 7

Given:

What is the result?

A. The sum is 2

B. The sum is 14

C. The sum is 15

D. The loop executes infinite times

E. Compilation fails

Browse 385 Q&As
Questions 8

int i, j=0;

i = (3* 2 +4 +5 ) ;

j = (3 * ((2+4) + 5));

System.out.println("i:"+ i + "\nj":+j);

What is the result?

A. Option A

B. Option B

C. Option C

D. Option D

Browse 385 Q&As
Questions 9

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 { }

Browse 385 Q&As
Questions 10

Given the code fragment: System.out.println(2 + 4 * 9 - 3); //Line 21 System.out.println((2 + 4) * 9 - 3); // Line 22 System.out.println(2 + (4 * 9) - 3); // Line 23 System.out.println(2 + 4 * (9 - 3)); // Line 24 System.out.println((2 + 4 * 9) - 3); // Line 25 Which line of codes prints the highest number?

A. Line 21

B. Line 22

C. Line 23

D. Line 24

E. Line 25

Browse 385 Q&As
Questions 11

Given the code fragment: List colors = new ArrayList(); colors.add("green"); colors.add("red"); colors.add("blue");

colors.add("yellow"); colors.remove(2); colors.add(3,"cyan"); System.out.print(colors); What is the result?

A. [green, red, yellow, cyan]

B. [green, blue, yellow, cyan]

C. [green, red, cyan, yellow]

D. Am IndexOutOfBoundsException is thrown at runtime

Browse 385 Q&As
Questions 12

Given:

What is the result?

A. Hello Log 2:2

B. Welcome Log 1:2

C. Welcome Log 2:1

D. Hello Log 1:2

Browse 385 Q&As
Questions 13

Given the definitions of the Bird class and the Peacock class:

and the code fragment:

Which code snippet can be inserted to print Fly.Dance. ?

A. Bird p = new Peacock();

B. Bird b = new Bird(); Peacock p = (Peacock) b;

C. Peacock b = new Peacock (); Bird p = (Bird) b;

D. Bird b = new Peacock (); Peacock p = (Peacock) b;

Browse 385 Q&As
Exam Code: 1Z0-808
Exam Name: Java SE 8 Programmer I
Last Update: May 04, 2024
Questions: 385 Q&As

PDF

$49.99

VCE

$59.99

PDF + VCE

$67.99