C# Garbage Collector (GC) Interview Questions and Answers

Question 1 : - Explain Garbage collector (GC)? Question 2 :- How does Garbage collector know when to clean the objects ? Question 3 :- Is there a way we can see this Heap memory ? Question 4 :- Does Garbage collector clean primitive types ? Question 5 : - Managed vs UnManaged code/objects/resources? Question 6 :- Can garbage collector clean unmanaged code ? Question 7 :- Explain Generations ? Question 8 :- What is GC0,GC1, and GC2 ? Question 9 :- Why do we need Generations ? Question 10 :- Which is the best place to clean unmanaged objects ? Question 11 :- How does GC behave when we have a destructor ? Question 12 :- What do you think about empty destructor ? Question 13 :- Explain the Dispose Pattern? Question 14 :- Finalize vs Destructor ? Question 15 :- What is the use of using keyword