Lyra
Learn
AI Learning Platform
π Midnight
π Comfort
π₯ Ember
π Paper
β Contrast
Exams
Sign in to track progress
β Back to the lesson
Module 2 Β· Quiz
Types, Memory, and GC
1. What is the primary difference between value types and reference types?
Value types are always stored on the stack.
Reference types are copied by value during assignment.
Value types use copy semantics while reference types use reference semantics.
Reference types cannot be compared by value.
2. Which of the following statements about boxing is true?
Boxing wraps a reference type in a heap object.
Boxing occurs when a value type is treated as an integer.
Generics have eliminated boxing altogether.
Boxing occurs when a value type is treated as an object.
3. What does the garbage collector (GC) primarily rely on regarding object lifespan?
Objects are collected in the order they are created.
Most objects are expected to die young, promoting efficient collection.
Garbage collection simplifies memory management by removing all objects immediately.
The GC does not collect objects in a specific generation order.
4. Which of the following correctly describes the role of `IDisposable` in relation to garbage collection?
`IDisposable` ensures all objects are immediately collected by the GC.
The GC automatically manages the disposal of all resources implementing `IDisposable`.
`IDisposable` is used to manage resources that the GC does not handle, like unmanaged resources.
The `IDisposable` interface replaces the need for garbage collection.
Submit answers
Continue: Async/Await Under Questioning β
Review this lesson
Retake quiz