Here are 10 essential multiple-choice questions on JVM Memory Management and Garbage Collection, covering key concepts.
Question 1
Which of the following is true about JVM Stack Memory?
It is used to store class-level data and references to objects
It stores method calls, local variables, and references to objects
It holds all instances of objects created in Java
It stores only static variables
Question 2
Which of the following is NOT a type of memory area allocated by the JVM?
Stack
Heap
Method Area
Local Variable Area
Question 3
What happens when an object becomes eligible for garbage collection in Java?
It is immediately deleted from memory
It is marked for garbage collection by the Garbage Collector (GC)
It is still accessible by other threads
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?
Stack Memory
Heap Memory
Method Area
Native Area
Question 5
What is Garbage Collection in the context of JVM memory management?
It is the process of allocating memory to JVM Stack
It is used to store objects in the Method Area
It is responsible for managing Stack memory
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?
It stores method calls and local variables
It is used for storing class-level data
It stores instances of all objects created during program execution
It is reserved for system resources
Question 7
Which of the following memory areas in the JVM is shared across all threads?
Stack
Heap
Method Area
Both B and C
Question 8
How does the Garbage Collector (GC) decide when to reclaim memory from unreachable objects?
Based on a predefined time interval
It uses reference counting to check for objects with zero references
It runs when the Stack Memory is full
When an object exceeds a certain size threshold
Question 9
What is Minor GC in Java?
It collects garbage from the Heap Space, particularly from the Young Generation
It is the collection of garbage from the Method Area
It collects garbage from the Stack Memory
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?
Stack Memory
Heap Memory
Method Area
Native Area
There are 10 questions to complete.