1z0-808 Practice Test practice questions, page 8 of 10, with answer review and explanations.
Question 36
Given the code fragment: Which code fragment, when inserted at line 9, enables the code to print true?
String str2 = str1;
String str2 = new String(str1);
String str2 = sb1. toString();
String str2 = "Duke";
Question 37
Given: What is the result?
Compilation fails.
false true
true false
true true
false false
Question 38
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? (Choose two.)
Option A
Option B
Option C
Option D
Option E
Question 39
Given: And given the commands: What is the result?
Success
Failure
Compilation fails.
An exception is thrown at runtime
Question 40
Which three statements describe the object-oriented features of the Java language? (Choose three.)
Objects can be reused.
A subclass must override the methods from a superclass.