Question 6
Given the code fragment: Which action enables the code to compile?
- Replace record with void.
- Replace record with class.
- Remove the regNo initialization statement.
- Make the regNo variable public.
- Make the regNo variable static.
Question 7
Given: What is the result?
- 0 CLOUDY
- 1 SNOWY
- 0 SNOWY
- 1 RAINY
- Compilation fails
Question 8
Given the code fragment: What is the result?
- 0 1 1 0
- false true true Optional[NewYear]
- 0 1 0 Optional[NewYear]
- true true false NewYear
Question 9
Given: Which statement is true while the program prints GC?
- Both the objects previously referenced by t1 are eligible for garbage collection.
- None of the objects are eligible for garbage collection.
- Only the object referenced by t2 is eligible for garbage collection.
- Only one of the objects previously referenced by t1 is eligible for garbage collection.
Question 10
Given: What is the result?
- Compilation fails.
- there
- hello
- A NumberFormatException is thrown.