Practice Java Memory Management MCQ questions with detailed explanations and clear answer validation. These MCQs help you revise core concepts, compare close options, and improve accuracy for interviews, certification exams, and technical screening rounds. Use this updated 2026 set to strengthen fundamentals and confidence.
Q51. Which statement about OutOfMemoryError is most accurate?
Select an answer to check.
Answer: Thrown when JVM cannot allocate.
Here, Thrown when JVM cannot allocate. is the right choice. Heap, Metaspace, direct memory variants. It aligns directly with what the question asks about which statement about outofmemoryerror is most accurate. Competing choices sound plausible, but they miss the key condition.
Q52. How is OutOfMemoryError best characterized?
Select an answer to check.
Answer: Thrown when JVM cannot allocate.
In this case, Thrown when JVM cannot allocate. is correct. Heap, Metaspace, direct memory variants. It aligns directly with what the question asks about how is outofmemoryerror best characterized. Competing choices sound plausible, but they miss the key condition.
Q53. Which option best describes StackOverflowError in Java?
Select an answer to check.
Answer: Stack frame depth exceeded.
The best option here is Stack frame depth exceeded.. Often from infinite recursion. It aligns directly with what the question asks about which option best describes stackoverflowerror in java. Competing choices sound plausible, but they miss the key condition.
Q54. What is the primary purpose of StackOverflowError?
Select an answer to check.
Answer: Stack frame depth exceeded.
For this question, Stack frame depth exceeded. is correct. Often from infinite recursion. It aligns directly with what the question asks about what is the primary purpose of stackoverflowerror. Competing choices sound plausible, but they miss the key condition.
Q55. Which statement about StackOverflowError is most accurate?
Select an answer to check.
Answer: Stack frame depth exceeded.
Stack frame depth exceeded. is the correct answer here. Often from infinite recursion. It aligns directly with what the question asks about which statement about stackoverflowerror is most accurate. Competing choices sound plausible, but they miss the key condition.
Q56. How is StackOverflowError best characterized?
Select an answer to check.
Answer: Stack frame depth exceeded.
Here, Stack frame depth exceeded. is the right choice. Often from infinite recursion. This matches the core idea being tested around how is stackoverflowerror best characterized. Competing choices sound plausible, but they miss the key condition.
Q57. Which option best describes direct memory in Java?
Select an answer to check.
Answer: ByteBuffer.allocateDirect outside heap.
In this case, ByteBuffer.allocateDirect outside heap. is correct. Faster I/O; manual sizing. This matches the core idea being tested around which option best describes direct memory in java. Competing choices sound plausible, but they miss the key condition.
Q58. What is the primary purpose of direct memory?
Select an answer to check.
Answer: ByteBuffer.allocateDirect outside heap.
The best option here is ByteBuffer.allocateDirect outside heap.. Faster I/O; manual sizing. This matches the core idea being tested around what is the primary purpose of direct memory. Competing choices sound plausible, but they miss the key condition.
Q59. Which statement about direct memory is most accurate?
Select an answer to check.
Answer: ByteBuffer.allocateDirect outside heap.
For this question, ByteBuffer.allocateDirect outside heap. is correct. Faster I/O; manual sizing. This matches the core idea being tested around which statement about direct memory is most accurate. Competing choices sound plausible, but they miss the key condition.
Q60. How is direct memory best characterized?
Select an answer to check.
Answer: ByteBuffer.allocateDirect outside heap.
ByteBuffer.allocateDirect outside heap. is the correct answer here. Faster I/O; manual sizing. This matches the core idea being tested around how is direct memory best characterized. Competing choices sound plausible, but they miss the key condition.
Q61. Which option best describes Metaspace in Java?
Select an answer to check.
Answer: Native memory holding class metadata.
Here, Native memory holding class metadata. is the right choice. Tunable via -XX flags. That is exactly the concept behind which option best describes metaspace in java in this context. Competing choices sound plausible, but they miss the key condition.
Q62. What is the primary purpose of Metaspace?
Select an answer to check.
Answer: Native memory holding class metadata.
In this case, Native memory holding class metadata. is correct. Tunable via -XX flags. That is exactly the concept behind what is the primary purpose of metaspace in this context. Competing choices sound plausible, but they miss the key condition.
Q63. Which statement about Metaspace is most accurate?
Select an answer to check.
Answer: Native memory holding class metadata.
The best option here is Native memory holding class metadata.. Tunable via -XX flags. That is exactly the concept behind which statement about metaspace is most accurate in this context. Competing choices sound plausible, but they miss the key condition.
Q64. How is Metaspace best characterized?
Select an answer to check.
Answer: Native memory holding class metadata.
For this question, Native memory holding class metadata. is correct. Tunable via -XX flags. That is exactly the concept behind how is metaspace best characterized in this context. Competing choices sound plausible, but they miss the key condition.
Q65. Which option best describes compaction in Java?
Select an answer to check.
Answer: GC moves objects to defragment heap.
GC moves objects to defragment heap. is the correct answer here. Reduces fragmentation. That is exactly the concept behind which option best describes compaction in java in this context. Competing choices sound plausible, but they miss the key condition.
Q66. What is the primary purpose of compaction?
Select an answer to check.
Answer: GC moves objects to defragment heap.
Here, GC moves objects to defragment heap. is the right choice. Reduces fragmentation. It fits the requirement in the prompt about what is the primary purpose of compaction. Competing choices sound plausible, but they miss the key condition.
Q67. Which statement about compaction is most accurate?
Select an answer to check.
Answer: GC moves objects to defragment heap.
In this case, GC moves objects to defragment heap. is correct. Reduces fragmentation. It fits the requirement in the prompt about which statement about compaction is most accurate. Competing choices sound plausible, but they miss the key condition.
Q68. How is compaction best characterized?
Select an answer to check.
Answer: GC moves objects to defragment heap.
The best option here is GC moves objects to defragment heap.. Reduces fragmentation. It fits the requirement in the prompt about how is compaction best characterized. Competing choices sound plausible, but they miss the key condition.
Q69. Which option best describes generational hypothesis in Java?
Select an answer to check.
Answer: Most objects die young.
For this question, Most objects die young. is correct. Underlies generational GC. It fits the requirement in the prompt about which option best describes generational hypothesis in java. Competing choices sound plausible, but they miss the key condition.
Q70. What is the primary purpose of generational hypothesis?
Select an answer to check.
Answer: Most objects die young.
Most objects die young. is the correct answer here. Underlies generational GC. It fits the requirement in the prompt about what is the primary purpose of generational hypothesis. Competing choices sound plausible, but they miss the key condition.
Q71. Which statement about generational hypothesis is most accurate?
Select an answer to check.
Answer: Most objects die young.
Here, Most objects die young. is the right choice. Underlies generational GC. This is the most accurate statement for which statement about generational hypothesis is most accurate. Competing choices sound plausible, but they miss the key condition.
Q72. How is generational hypothesis best characterized?
Select an answer to check.
Answer: Most objects die young.
In this case, Most objects die young. is correct. Underlies generational GC. This is the most accurate statement for how is generational hypothesis best characterized. Competing choices sound plausible, but they miss the key condition.
Q73. Which option best describes card table in Java?
Select an answer to check.
Answer: Tracks old-gen references to young-gen for minor GC.
The best option here is Tracks old-gen references to young-gen for minor GC.. Used by generational collectors. This is the most accurate statement for which option best describes card table in java. Competing choices sound plausible, but they miss the key condition.
Q74. What is the primary purpose of card table?
Select an answer to check.
Answer: Tracks old-gen references to young-gen for minor GC.
For this question, Tracks old-gen references to young-gen for minor GC. is correct. Used by generational collectors. This is the most accurate statement for what is the primary purpose of card table. Competing choices sound plausible, but they miss the key condition.
Q75. Which statement about card table is most accurate?
Select an answer to check.
Answer: Tracks old-gen references to young-gen for minor GC.
Tracks old-gen references to young-gen for minor GC. is the correct answer here. Used by generational collectors. This is the most accurate statement for which statement about card table is most accurate. Competing choices sound plausible, but they miss the key condition.
Q76. How is card table best characterized?
Select an answer to check.
Answer: Tracks old-gen references to young-gen for minor GC.
Here, Tracks old-gen references to young-gen for minor GC. is the right choice. Used by generational collectors. It aligns directly with what the question asks about how is card table best characterized. The remaining choices fail because they don’t satisfy the full definition.
Q77. Which option best describes write barriers in Java?
Select an answer to check.
Answer: Code inserted on writes to maintain GC invariants.
In this case, Code inserted on writes to maintain GC invariants. is correct. Critical for incremental/generational GC. It aligns directly with what the question asks about which option best describes write barriers in java. The remaining choices fail because they don’t satisfy the full definition.
Q78. What is the primary purpose of write barriers?
Select an answer to check.
Answer: Code inserted on writes to maintain GC invariants.
The best option here is Code inserted on writes to maintain GC invariants.. Critical for incremental/generational GC. It aligns directly with what the question asks about what is the primary purpose of write barriers. The remaining choices fail because they don’t satisfy the full definition.
Q79. Which statement about write barriers is most accurate?
Select an answer to check.
Answer: Code inserted on writes to maintain GC invariants.
For this question, Code inserted on writes to maintain GC invariants. is correct. Critical for incremental/generational GC. It aligns directly with what the question asks about which statement about write barriers is most accurate. The remaining choices fail because they don’t satisfy the full definition.
Q80. How is write barriers best characterized?
Select an answer to check.
Answer: Code inserted on writes to maintain GC invariants.
Code inserted on writes to maintain GC invariants. is the correct answer here. Critical for incremental/generational GC. It aligns directly with what the question asks about how is write barriers best characterized. The remaining choices fail because they don’t satisfy the full definition.
Q81. Which option best describes NUMA-aware GC in Java?
Select an answer to check.
Answer: GC aware of CPU socket memory locality.
Here, GC aware of CPU socket memory locality. is the right choice. Reduces remote memory traffic. This matches the core idea being tested around which option best describes numa-aware gc in java. The remaining choices fail because they don’t satisfy the full definition.
Q82. What is the primary purpose of NUMA-aware GC?
Select an answer to check.
Answer: GC aware of CPU socket memory locality.
In this case, GC aware of CPU socket memory locality. is correct. Reduces remote memory traffic. This matches the core idea being tested around what is the primary purpose of numa-aware gc. The remaining choices fail because they don’t satisfy the full definition.
Q83. Which statement about NUMA-aware GC is most accurate?
Select an answer to check.
Answer: GC aware of CPU socket memory locality.
The best option here is GC aware of CPU socket memory locality.. Reduces remote memory traffic. This matches the core idea being tested around which statement about numa-aware gc is most accurate. The remaining choices fail because they don’t satisfy the full definition.
Q84. How is NUMA-aware GC best characterized?
Select an answer to check.
Answer: GC aware of CPU socket memory locality.
For this question, GC aware of CPU socket memory locality. is correct. Reduces remote memory traffic. This matches the core idea being tested around how is numa-aware gc best characterized. The remaining choices fail because they don’t satisfy the full definition.
Q85. Which option best describes memory leaks in Java in Java?
Select an answer to check.
Answer: Unintended retention via static refs/caches/listeners.
Unintended retention via static refs/caches/listeners. is the correct answer here. GC can't collect retained objects. This matches the core idea being tested around which option best describes memory leaks in java. The remaining choices fail because they don’t satisfy the full definition.
Q86. What is the primary purpose of memory leaks in Java?
Select an answer to check.
Answer: Unintended retention via static refs/caches/listeners.
Here, Unintended retention via static refs/caches/listeners. is the right choice. GC can't collect retained objects. That is exactly the concept behind what is the primary purpose of memory leaks in this context. The remaining choices fail because they don’t satisfy the full definition.
Q87. Which statement about memory leaks in Java is most accurate?
Select an answer to check.
Answer: Unintended retention via static refs/caches/listeners.
In this case, Unintended retention via static refs/caches/listeners. is correct. GC can't collect retained objects. That is exactly the concept behind which statement about memory leaks in java is in this context. The remaining choices fail because they don’t satisfy the full definition.
Q88. How is memory leaks in Java best characterized?
Select an answer to check.
Answer: Unintended retention via static refs/caches/listeners.
The best option here is Unintended retention via static refs/caches/listeners.. GC can't collect retained objects. That is exactly the concept behind how is memory leaks in java best characterized in this context. The remaining choices fail because they don’t satisfy the full definition.
Q89. Which option best describes ThreadLocal leaks in Java?
Select an answer to check.
Answer: ThreadLocal values retaining objects in pools.
For this question, ThreadLocal values retaining objects in pools. is correct. Remove() to clear. That is exactly the concept behind which option best describes threadlocal leaks in java in this context. The remaining choices fail because they don’t satisfy the full definition.
Q90. What is the primary purpose of ThreadLocal leaks?
Select an answer to check.
Answer: ThreadLocal values retaining objects in pools.
ThreadLocal values retaining objects in pools. is the correct answer here. Remove() to clear. That is exactly the concept behind what is the primary purpose of threadlocal leaks in this context. The remaining choices fail because they don’t satisfy the full definition.
Q91. Which statement about ThreadLocal leaks is most accurate?
Select an answer to check.
Answer: ThreadLocal values retaining objects in pools.
Here, ThreadLocal values retaining objects in pools. is the right choice. Remove() to clear. It fits the requirement in the prompt about which statement about threadlocal leaks is most accurate. The remaining choices fail because they don’t satisfy the full definition.
Q92. How is ThreadLocal leaks best characterized?
Select an answer to check.
Answer: ThreadLocal values retaining objects in pools.
In this case, ThreadLocal values retaining objects in pools. is correct. Remove() to clear. It fits the requirement in the prompt about how is threadlocal leaks best characterized. The remaining choices fail because they don’t satisfy the full definition.
Q93. Which option best describes ClassLoader leaks in Java?
Select an answer to check.
Answer: Classloader unable to be GC'd retains classes.
The best option here is Classloader unable to be GC'd retains classes.. Common in app servers. It fits the requirement in the prompt about which option best describes classloader leaks in java. The remaining choices fail because they don’t satisfy the full definition.
Q94. What is the primary purpose of ClassLoader leaks?
Select an answer to check.
Answer: Classloader unable to be GC'd retains classes.
For this question, Classloader unable to be GC'd retains classes. is correct. Common in app servers. It fits the requirement in the prompt about what is the primary purpose of classloader leaks. The remaining choices fail because they don’t satisfy the full definition.
Q95. Which statement about ClassLoader leaks is most accurate?
Select an answer to check.
Answer: Classloader unable to be GC'd retains classes.
Classloader unable to be GC'd retains classes. is the correct answer here. Common in app servers. It fits the requirement in the prompt about which statement about classloader leaks is most accurate. The remaining choices fail because they don’t satisfy the full definition.
Q96. How is ClassLoader leaks best characterized?
Select an answer to check.
Answer: Classloader unable to be GC'd retains classes.
Here, Classloader unable to be GC'd retains classes. is the right choice. Common in app servers. This is the most accurate statement for how is classloader leaks best characterized. The remaining choices fail because they don’t satisfy the full definition.
Q97. Which option best describes memory profiling in Java?
Select an answer to check.
Answer: Tools to find allocations and retention.
In this case, Tools to find allocations and retention. is correct. JFR, VisualVM, async-profiler. This is the most accurate statement for which option best describes memory profiling in java. The remaining choices fail because they don’t satisfy the full definition.
Q98. What is the primary purpose of memory profiling?
Select an answer to check.
Answer: Tools to find allocations and retention.
The best option here is Tools to find allocations and retention.. JFR, VisualVM, async-profiler. This is the most accurate statement for what is the primary purpose of memory profiling. The remaining choices fail because they don’t satisfy the full definition.
Q99. Which statement about memory profiling is most accurate?
Select an answer to check.
Answer: Tools to find allocations and retention.
For this question, Tools to find allocations and retention. is correct. JFR, VisualVM, async-profiler. This is the most accurate statement for which statement about memory profiling is most accurate. The remaining choices fail because they don’t satisfy the full definition.
Q100. How is memory profiling best characterized?
Select an answer to check.
Answer: Tools to find allocations and retention.
Tools to find allocations and retention. is the correct answer here. JFR, VisualVM, async-profiler. This is the most accurate statement for how is memory profiling best characterized. The remaining choices fail because they don’t satisfy the full definition.