oracle 1z0-808 practice test

Java SE 8 Programmer I Exam

Last exam update: Feb 20 ,2024
Page 1 out of 13. Viewing questions 1-15 out of 190

Question 1

Given the code fragment:

What is the result?
A. It results in a compile time error at line 18.
B. It results in a compile time error at line 9.
C. It prints : 1
D. It results in a compile time error at lines at lines 12 and 15.

Answer:

A

Discussions
0 / 1000

Question 2

Examine:

Which statement is true?

  • A. The program prints m1.Accessed.
  • B. The program fails compile due to the unhandled E1 exception.
  • C. The program prints m2.Accessed.
  • D. The program fails to compile due to the unhandled E2 exception.
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 3

Given the code fragment:

What is the result?

  • A. 1 2 3 0 01 2 3 0 0
  • B. An Exception is thrown at run time.
  • C. 1 2 3 0 01 2 3
  • D. 1 2 31 2 3
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 4

Given:

Which action fixes the compiler error?

  • A. At line 17, add throws AccessViolationException
  • B. At line 13, add throws LogFileException
  • C. At line 2, replace throws LogFileException with throws AccessViolationException
  • D. At line 7, insert throw new LogFileException ();
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 5

Given the code fragment:

What is the result?

  • A. 2 : 7 : 3
  • B. 7 : 7 : 9
  • C. 2 : 7 : 0
  • D. 7 : 2 : 3
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

Given the code fragment:

What is the result?

  • A. 11
  • B. 10
  • C. 12
  • D. A compile time error occurs.
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 7

Given the code fragment:

Which two code fragments inserted at line 10 print ****?


  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
  • E. Option E
Answer:

E

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 8

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;
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 9

Given the code fragment:

Which action enables it to print AB?

  • A. Comment lines 18 to 21.
  • B. Comment line 20.
  • C. Comment line 19.
  • D. Comment line 16.
Answer:

B

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 10

Given the code fragment:

What is the result?
A. Sum is 600
B. Compilation fails at line n1.
C. Compilation fails at line n2.
D. A ClassCastException is thrown at line n1.
E. A ClassCastException is thrown at line n2.

Answer:

E

Discussions
0 / 1000

Question 11

Given the code fragment:

What is the result?

  • A. 2012-02-10
  • B. 2012-01-30
  • C. 2012-02-10 00:00
  • D. A DateTimeException is thrown at runtime.
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 12

Given:

What is the result?

  • A. Compilation fails.
  • B. false true
  • C. true false
  • D. true true
  • E. false false
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 13

Given the definitions of the MyString class and the Test class:

What is the result?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
  • E. Option E
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 14

Given:

What is the result?

  • A. BaseDerivedA
  • B. BaseDerivedB
  • C. DerivedBDerivedB
  • D. DerivedBDerivedA
  • E. A ClassCastException is thrown at runtime.
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 15

Given the code fragment:

What is the result?

  • A. Answer = 0
  • B. Invalid calculation
  • C. Compilation fails only at line n1.
  • D. Compilation fails only at line n2.
  • E. Compilation fails at line n1 and line2.
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
E
0 / 1000
To page 2