Problem Statement
How does garbage collection differ from deterministic destruction in object-oriented languages?
Explanation
In garbage-collected languages (like Java, C#) objects are destroyed when the runtime’s GC deems them unreachable. This is non-deterministic compared to languages like C++ where destructors run immediately when scope ends or when delete is called. Understanding this helps interview candidates discuss resource management trade-offs.
Practice Sets
This question appears in the following practice sets: