Free preview mode

Enjoy the free questions and consider upgrading to gain full access!

1z0-808Free trialFree trial

By oracle
Aug, 2025

Verified

25Q per page

Question 26

Given the code fragment:

Image 1

What is the result?

  • A: 3
  • B: 4
  • C: -1
  • D: Compilation fails.

Question 27

Given the code fragment:

Image 1

What is the result?

  • A: 2012-02-10
  • B: 2012-02-11
  • C: Compilation fails
  • D: A DateTimeException is thrown at runtime.

Question 28

Given:

Image 1

What is the result?

  • A: 10 : 30 : 6
  • B: 10 : 22 : 22
  • C: 10 : 22 : 20
  • D: 10 : 22 : 6

Question 29

Given:

Image 1

And given the code fragment:

Image 2

What is the result?

  • A: Compilation fails at line n2.
  • B: Read Book
  • C: Read E-Book
  • D: Compilation fails at line n1.
  • E: Compilation fails at line n3.

Question 30

Given this class:

Image 1

Which two changes would encapsulate this class and ensure that the area field is always equal to length * height whenever the Rectangle class is used?
(Choose two.)

  • A: Call the setArea method at the end of the setHeight method.
  • B: Call the setArea method at the beginning of the setHeight method.
  • C: Call the setArea method at the end of the setLength method.
  • D: Call the setArea method at the beginning of the setLength method.
  • E: Change the setArea method to private.
  • F: Change the area field to public.

Question 31

Given the code fragment:

Image 1

What is the result?

  • A: [green, red, yellow, cyan]
  • B: [green, blue, yellow, cyan]
  • C: [green, red, cyan, yellow]
  • D: An IndexOutOfBoundsException is thrown at runtime.

Question 32

Given the code fragment:

Image 1

Which three code fragments are valid at line n1? (Choose three.)
A.

Image 2

B.

Image 3

C.

Image 4

D.

Image 5

E.

Image 6

Question 33

Given:

Image 1

What is the result?

  • A: Compilation fails.
  • B: 3 5
  • C: 0 0
  • D: 9 25

Question 34

Given:

Image 1

Which code fragment should you use at line n1 to instantiate the dvd object successfully?

Image 2
  • A: Option A
  • B: Option B
  • C: Option C
  • D: Option D

Question 35

Given the code fragment:

Image 1

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)
A.

Image 2

B.

Image 3

C.

Image 4

D.

Image 5

E.

Image 6

Question 36

Given:

Image 1

What is the result?

  • A: 10 Hello Hello 11
  • B: 10 Hello Hello 121
  • C: 100 Hello 121
  • D: 100 Hello Hello 121
  • E: 10 Hello 11

Question 37

Given the code fragment:

Image 1

What is the result?

  • A: Compilation fails.
  • B: Hi removed
  • C: An UnsupportedOperationException is thrown at runtime.
  • D: The program compiles, but it prints nothing.

Question 38

Which two class definitions fail to compile? (Choose two.)
A.

Image 1

B.

Image 2

C.

Image 3

D.

Image 4

E.

Image 5

Question 39

Given:

Image 1

What is the result?

  • A: null Richard Donald
  • B: Richard Donald
  • C: Compilation fails.
  • D: An ArrayIndexOutOfBoundsException is thrown at runtime.
  • E: A NullPointerException is thrown at runtime.

Question 40

This grid shows the state of a 2D array:

Image 1

The grid is created with this code:

Image 2

Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive XS?

  • A: grid[2][1] = 'X';
  • B: grid[3][2] = 'X';
  • C: grid[3][1] = 'X';
  • D: grid[2][3] = 'X';

Question 41

Given:

Image 1

What is the result?

  • A: Hello Log 1:0
  • B: Hello Log 2:1
  • C: Welcome Log 2:1
  • D: Welcome Log 1:0

Question 42

Given the code snippet from a compiled Java source file:

Image 1

Which command-line arguments should you pass to the program to obtain the following output?

Arg is 2 -

  • A: java MyFile 1 3 2 2
  • B: java MyFile 2 2 2
  • C: java MyFile 1 2 2 3 4
  • D: java MyFile 0 1 2 3

Question 43

Given the code fragment:

Image 1

Which two modifications should you make so that the code compiles successfully? (Choose two.)

  • A: Replace line 13 with:
  • B: Replace line 7 with throw IOException (ג€Exception raisedג€);
  • C: Replace line 11 with public static void main(String[]) args) throws Exception {
  • D: At line 14, insert throw new IOException();
  • E: Replace line 5 with public void printFileContent() throws IOException {

Question 44

Given the code fragment:

Image 1

What is the result?

  • A: 1 3 5 7 1 3
  • B: 1 3 1 3
  • C: 1 3 1 3 0 0
  • D: 1 3 followed by an ArrayIndexOutOfBoundsException
  • E: Compilation fails.

Question 45

Given the code fragment:

Image 1

Which option can replace xxx to enable the code to print 135?
A.

Image 2

B.

Image 3

C.

Image 4

D.

Image 5

Question 46

Given:
MainTest.java:

Image 1

and commands:

Image 2

What is the result?

  • A: String main 1
  • B: An exception is thrown at runtime
  • C: String main 1 2 3
  • D: String main 123

Question 47

Which two statements are true about Java byte code? (Choose two.)

  • A: It can be serialized across network.
  • B: It can run on any platform that has a Java compiler.
  • C: It can run on any platform.
  • D: It has ג€.javaג€ extension.
  • E: It can run on any platform that has the Java Runtime Environment.

That’s the end of your free questions

You’ve reached the preview limit for 1z0-808

Consider upgrading to gain full access!

Page 2 of 10 • Questions 26-50 of 234

Free preview mode

Enjoy the free questions and consider upgrading to gain full access!