1z0-829 Practice Test

1z0-829 Practice Test practice questions, page 2 of 4, with answer review and explanations.

Question 6

Given the code fragment: Which action enables the code to compile?

  1. Replace record with void.
  2. Replace record with class.
  3. Remove the regNo initialization statement.
  4. Make the regNo variable public.
  5. Make the regNo variable static.

Question 7

Given: What is the result?

  1. 0 CLOUDY
  2. 1 SNOWY
  3. 0 SNOWY
  4. 1 RAINY
  5. Compilation fails

Question 8

Given the code fragment: What is the result?

  1. 0 1 1 0
  2. false true true Optional[NewYear]
  3. 0 1 0 Optional[NewYear]
  4. true true false NewYear

Question 9

Given: Which statement is true while the program prints GC?

  1. Both the objects previously referenced by t1 are eligible for garbage collection.
  2. None of the objects are eligible for garbage collection.
  3. Only the object referenced by t2 is eligible for garbage collection.
  4. Only one of the objects previously referenced by t1 is eligible for garbage collection.

Question 10

Given: What is the result?

  1. Compilation fails.
  2. there
  3. hello
  4. A NumberFormatException is thrown.