oracle 1z0-808 practice test

Exam Title: Java SE 8 Programmer

Last update: Dec 16 ,2025
Question 1

Given:

And given the code fragment:
Book book1 = new EBook();
book1.readBook();

Which option enables the code to compile?

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

D

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 2

Given:

What is the result?

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

C

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 3

Given:

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

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

C

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 4

Given the code fragment:

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

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

B

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 5

Which statement best describes encapsulation?

  • A. Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.
  • B. Encapsulation ensures that classes can be designed so that their methods are inheritable.
  • C. Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.
  • D. Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.
Answer:

A

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 6

Given the code fragment from three files:

Which code fragment, when inserted at line 2, enables the code to compile?


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

E

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 7

Given this class:

And given this main method, located in another class:

Which three lines, when inserted independently at line n1, cause the program to print a 0 balance?

  • A. acct.setAmount(-acct.getAmount());
  • B. acct.amount = 0; <option D earlier>
  • C. acct.setAmount(0);
  • D. acct.getAmount() = 0; <option E earlier>
  • E. this.amount = 0; <option A earlier>
  • F. acct.changeAmount(0); <option F earlier>
  • G. acct.changeAmount(-acct.amount); <option G earlier>
Answer:

B,D,F

vote your answer:
A
B
C
D
E
F
G
A 0 B 0 C 0 D 0 E 0 F 0 G 0
Comments
Question 8

Given the code fragment:

Which code fragment prints red: blue: small: medium?


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

D

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 9

Given the code fragment:


What is the result?

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

D

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 10

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:

B

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Page 1 out of 18
Viewing questions 1-10 out of 190
Go To
page 2