JVM Memory Management and Garbage Collection

Last Updated :
Discuss
Comments

Question 1

Which of the following is true about JVM Stack Memory?

  • A

    It is used to store class-level data and references to objects

  • B

    It stores method calls, local variables, and references to objects

  • C

    It holds all instances of objects created in Java

  • D

    It stores only static variables

Question 2

Which of the following is NOT a type of memory area allocated by the JVM?

  • A

    Stack

  • B

    Heap

  • C

    Method Area

  • D

    Local Variable Area

Question 3

What happens when an object becomes eligible for garbage collection in Java?

  • A

    It is immediately deleted from memory

  • B

    It is marked for garbage collection by the Garbage Collector (GC)


  • C

    It is still accessible by other threads

  • D

    It is moved to the Heap space for permanent storage

Question 4

Which of the following memory areas in JVM is used to store class-level data like static variables and methods?

  • A

    Stack Memory

  • B

    Heap Memory

  • C

    Method Area

  • D

    Native Area

Question 5

What is Garbage Collection in the context of JVM memory management?

  • A

    It is the process of allocating memory to JVM Stack


  • B

    It is used to store objects in the Method Area

  • C

    It is responsible for managing Stack memory

  • D

    It is the process of deallocating unused memory and objects in the Heap


Question 6

What is the role of the Heap Memory in JVM?

  • A

    It stores method calls and local variables


  • B

    It is used for storing class-level data


  • C

    It stores instances of all objects created during program execution

  • D

    It is reserved for system resources

Question 7

Which of the following memory areas in the JVM is shared across all threads?

  • A

    Stack

  • B

    Heap


  • C

    Method Area

  • D

    Both B and C

Question 8

How does the Garbage Collector (GC) decide when to reclaim memory from unreachable objects?


  • A

    Based on a predefined time interval

  • B

    It uses reachability analysis to identify unreachable objects

  • C

    It runs when the Stack Memory is full


  • D

    When an object exceeds a certain size threshold

Question 9

What is Minor GC in Java?

  • A

    It collects garbage from the Heap Space, particularly from the Young Generation

  • B

    It is the collection of garbage from the Method Area


  • C

    It collects garbage from the Stack Memory


  • D

    It is an external process that interacts with JVM to free up memory

Question 10

Which JVM memory area is cleared automatically when a thread is terminated?

  • A

    Stack Memory


  • B

    Heap Memory

  • C

    Method Area

  • D

    Native Area

There are 10 questions to complete.

Take a part in the ongoing discussion