Practice mode / Java Which provides runtime environment for java byte code to be executed? A Option A: JDK B Option B: JVM C Option C: JRE D Option D: JAVAC Correct answer B. JVM Show answer Report a problem How we write and check questions
Question 01 / Java Why does declaring an int field count as volatile fail to make count++ thread-safe in Java? A Option A: The volatile modifier cannot be applied to int fields B Option B: A volatile field is copied separately for each thread C Option C: The increment is a separate read, change and write D Option D: The volatile modifier makes every read much too slow Correct answer C. The increment is a separate read, change and write Show answer Open question
Question 02 / Java What happens if a Java thread calls obj.wait() without owning the monitor of obj? A Option A: The thread waits and acquires the monitor later B Option B: The call returns immediately with no effect C Option C: The compiler reports an error D Option D: An IllegalMonitorStateException is thrown Correct answer D. An IllegalMonitorStateException is thrown Show answer Open question
Question 03 / Java Which of these can a Java record class not declare in its body? A Option A: An additional instance field B Option B: An instance method C Option C: A compact canonical constructor D Option D: A static field Correct answer A. An additional instance field Show answer Open question
Question 04 / Java In which JVM run-time data area are objects and arrays allocated? A Option A: The native method stack B Option B: The program counter register C Option C: The JVM stack D Option D: The heap Correct answer D. The heap Show answer Open question
Discussion