1z0-808 Practice Test

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?

  1. String str2 = str1;
  2. String str2 = new String(str1);
  3. String str2 = sb1. toString();
  4. String str2 = "Duke";

Question 37

Given: What is the result?

  1. Compilation fails.
  2. false true
  3. true false
  4. true true
  5. 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.)

  1. Option A
  2. Option B
  3. Option C
  4. Option D
  5. Option E

Question 39

Given: And given the commands: What is the result?

  1. Success
  2. Failure
  3. Compilation fails.
  4. An exception is thrown at runtime

Question 40

Which three statements describe the object-oriented features of the Java language? (Choose three.)

  1. Objects can be reused.
  2. A subclass must override the methods from a superclass.
  3. Objects can share behaviors with other objects.
  4. A package must contain a main class.
  5. Object is the root class of all other objects.
  6. A main method must be declared in every class.