Skip to content
Sharp

Memory Management · interview question

What happens to the memory allocated for objects on the Heap when they are no longer referenced?

Multiple choiceEasychapter-14-curatedpremiummemory-managementstack-vs-heap
Choose one answer
Answer and explanation

Correct answer

D. They are eligible for garbage collection.

Why

Objects on the Heap that are no longer referenced become eligible for garbage collection, allowing the JVM to reclaim memory. This process is not immediate but rather occurs during a garbage collection cycle.

Test yourself on Memory Management

A free test with instant, explained results. No account needed.

Start free test
All Memory Management questions →