Oracle Java SE 8 Programmer I (1z1-808) Free Practice Test
Question 1
Given the code fragments:

Which code fragment, when inserted at line n1, enables the code to print Hank?

Which code fragment, when inserted at line n1, enables the code to print Hank?
Correct Answer: C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 2
Given the code fragment

Which code fragments, inserted independently, enable the code compile? (Choose 3)

Which code fragments, inserted independently, enable the code compile? (Choose 3)
Correct Answer: A,B,C
Question 3
Given:

What is the result?

What is the result?
Correct Answer: C
Question 4
Which three statements are benefits of encapsulation?
Correct Answer: A,C,D
Question 5
Given the code fragment:

Which code snippet at line 9 prints true?


Which code snippet at line 9 prints true?

Correct Answer: D
Question 6
You are asked to develop a program for a shopping application, and you are given the following information:
- The application must contain the classes Toy, EduToy, and consToy.
- The Toy class is the superclass of the other two classes.
- The int caicuiatePrice (Toy t) method calculates the price of a toy.
- The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

- The application must contain the classes Toy, EduToy, and consToy.
- The Toy class is the superclass of the other two classes.
- The int caicuiatePrice (Toy t) method calculates the price of a toy.
- The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

Correct Answer: C
Explanation: Only visible for TestSimulate members. You can sign-up / login (it's free).
Question 7
Given the code fragment:

And given the requirements:
- If the value of the qty variable is greater than or equal to 90,
discount = 0.5
- If the value of the qty variable is between 80 and 90, discount = 0.2 Which two code fragments can be independently placed at line n1 to meet the requirements?


And given the requirements:
- If the value of the qty variable is greater than or equal to 90,
discount = 0.5
- If the value of the qty variable is between 80 and 90, discount = 0.2 Which two code fragments can be independently placed at line n1 to meet the requirements?

Correct Answer: C,D
Question 8
Given the code fragment:

What is the result?

What is the result?
Correct Answer: D
Question 9
Given:

What is the result?

What is the result?
Correct Answer: D
Question 10
Given:

What is the result?

What is the result?
Correct Answer: D