Any2Quiz
Computer Science / Languages / Java

JVM Internals Quiz - Languages Java

Free practice quiz: JVM Internals (Languages Java). 53 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

Play all 53 questions free

Sample questions

  1. Which component of the JVM is responsible for converting Java bytecode into machine code during runtime?

    1. Class Loader
    2. Execution Engine
    3. Garbage Collector
    4. Java Native Interface (JNI)
    Show answer

    Answer: B. Execution Engine

    The Execution Engine is the core of the JVM responsible for executing the bytecode. It includes the Interpreter (which executes bytecode instruction by instruction) and the Just-In-Time (JIT) compiler (which compiles frequently used bytecode into native machine code for faster execution).

  2. What is the primary function of the JIT (Just-In-Time) compiler within the JVM?

    1. To parse Java source code
    2. To load and link classes
    3. To convert bytecode into native machine code for performance optimization
    4. To manage garbage collection
    Show answer

    Answer: C. To convert bytecode into native machine code for performance optimization

    The JIT compiler identifies frequently executed sections of bytecode (hotspots) and compiles them into native machine code. This compiled code is then executed directly by the CPU, significantly improving application performance compared to interpretation alone.

  3. Which of the following garbage collection algorithms is known for its generational approach?

    1. Mark and Sweep
    2. Copying Collector
    3. Generational Garbage Collector
    4. Reference Counting
    Show answer

    Answer: C. Generational Garbage Collector

    Generational garbage collectors are based on the hypothesis that most objects die young. They divide the heap into generations (e.g., Young Generation, Old Generation) and apply different collection strategies to each, optimizing the process.

  4. Which of the following is NOT a phase of Java Class Loading?

    1. Loading
    2. Linking
    3. Execution
    4. Initialization
    Show answer

    Answer: C. Execution

    Class loading involves three main phases: Loading (finding and loading the `.class` file), Linking (verifying, preparing, and resolving), and Initialization (executing static initializers). Execution is the overall process of running the Java program, not a specific phase of class loading itself.

  5. What happens to objects that survive multiple garbage collection cycles in the young generation of a generational GC?

    1. They are immediately deallocated.
    2. They are promoted to the old generation.
    3. They are moved to a different heap space.
    4. They are marked for deletion in the next cycle.
    Show answer

    Answer: B. They are promoted to the old generation.

    Generational garbage collectors move 'survivor' objects (those that have survived at least one minor collection) from the young generation to the old generation. This strategy is based on the observation that most objects die young, so objects that persist are more likely to live longer.

Take the full quiz

More quizzes

Browse all Java quizzes