Skip to content
Sharp

Memory Management · interview question

How does Generational Garbage Collection optimize memory management in Java?

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

Correct answer

A. By separating objects based on their lifespan.

Why

Generational Garbage Collection optimizes memory management by separating objects based on their lifespan into young and old generations. This allows frequent collections of short-lived objects (young generation) and less frequent collections of long-lived objects (old generation), improving performance.

Test yourself on Memory Management

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

Start free test
All Memory Management questions →