Select chapter



Basics (2.papers)
Data Types (2.papers)
enums (2.papers)
OOPS (4.papers)
Arrays (1.papers)
Structs (2.papers)
Properties (2.papers)
Strings (2.papers)
Interfaces (1.papers)
Constructors (2.papers)
Ref-Out-Keywords (1.papers)
Collections (2.papers)
Generics (1.papers)
Hide

Sponsored Links


  

c# garbage collection interview questions and answers

Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
4
What happens during Garbage Collection?
  1. A marking phase that finds and creates a list of all live objects.
  2. A relocating phase that updates the references to the objects that will be compacted.
  3. A compacting phase that reclaims the space occupied by the dead objects and compacts the surviving objects. The compacting phase moves objects that have survived a garbage collection toward the older end of the segment
  4. a,b and c
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
6
How to overcome the destructor problem during garbage collection ? 
  1. Not Possible.
  2. By implementing Idisposable.
  3. Using Finalize method.
  4. Call the destructor explicitly.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
8
How to call Garbage collector programmatically ?     
  1. GC.Finalize();
  2. GC.Collect();
  3. IDisposable
  4. Gc.SuppressFinalizers();
Show Answer
Share Facebook gmail Twitter
9
What is the use of the Dispose method in garbage collection ?
  1. For cleaning managed objects.
  2. For forcing garbage collector to run.
  3. For calling the destructor.
  4. For removing unmanaged resources.
Show Answer
Share Facebook gmail Twitter
10
Who is responsible for calling garbage collector?
  1. CLR
  2. JIT compiler
  3. C# compiler
  4. Managed Heap
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
13
Which of the following is not true for garbage collection? 
  1. It manages the reclamation of unused memory.
  2. It deals with circular references.
  3. You can be certain when an object will be reclaimed by garbage collector.
  4. It disposes unreferenced objects.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
15
When does garbage collector runs ?
  1. Every one minute
  2. When application is running with low memory space.
  3. When as exception occurs in the application.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
16
What is Managed Heap?
  1. Managed heap is a portion of continuous memory in heap which is available for CLR to allocate and de-allocate objects.
  2. Managed heap is a portion of heap, which is used by CLR for storing and managing objects which are not created by CLR.
Show Answer
Share Facebook gmail Twitter
17
What is the use of destructor in c sharp?
  1. A destructor is used for destroying managed objects only.
  2. A destructor used for destroying only unmanaged objects only.
  3. A destructor can be used for destroying both managed and unmanaged objects.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
20
How to create a destructor in c sharp ( identify the correct syntax )?
  1. public class A{
    private int x;
    ~A(int x) { this.x=x; }
    }
  2. public class A{
    public ~A() {  }
    }
  3. public class A{
    ~ public A() {  }
    }
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
Read more papers :