Skip to content
Sharp

Garbage Collection · interview question

In a Generational Garbage Collector, what triggers an object to move from the Young Generation to the Old Generation?

Multiple choiceHardchapter-14-curatedpremiumgarbage-collectiongenerational-gc
Choose one answer
Answer and explanation

Correct answer

A. Surviving multiple Minor GCs.

Why

An object is promoted from the Young Generation to the Old Generation after it survives a certain number of Minor GCs. This is based on the assumption that long-lived objects are less likely to become unreachable.

Test yourself on Garbage Collection

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

Start free test
All Garbage Collection questions →