0% found this document useful (0 votes)
3K views2 pages

MCQs On Garbage Collector

The document contains 15 multiple choice questions about garbage collection. Specifically, it asks about garbage collection in C#, .NET, Java, and concepts like generations and finalize methods. Key topics covered include explicitly calling the garbage collector, what determines if an object is eligible for collection, and when background garbage collection was introduced in the .NET framework.

Uploaded by

Ussama Zubair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views2 pages

MCQs On Garbage Collector

The document contains 15 multiple choice questions about garbage collection. Specifically, it asks about garbage collection in C#, .NET, Java, and concepts like generations and finalize methods. Key topics covered include explicitly calling the garbage collector, what determines if an object is eligible for collection, and when background garbage collection was introduced in the .NET framework.

Uploaded by

Ussama Zubair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MCQs on Garbage Collector

1. Which of the following method is used to explicitly call garbage collector in C#?

a) System.GC. b) System.GC.Collect c) System.GC.Garbage d) System.GC.Clean

2. Garbage Collection has ____ Generations.

a) 1 b) 2 c) 3 d) 4

3. Which of the following is the C/C++ library for garbage collection?

a) Boehm b) SOCI c) Loki d) Scons

4. In .Net garbage collector is initiated by:

a) CLR b) MSIL c) Both d) None

5. The garbage collector uses which of the following to determine whether objects are live?

a) Stack roots b) Garbage collection handles c) Static Data d) All of the


above

6. You can use the ___ element of the runtime configuration schema to specify the type of
garbage collection you want the CLR to perform.

a) <gcCLR> b) <gcServer> c) <gcType> d) <gcConfig>

7. Background garbage collection is available only in the .NET Framework __ and later versions.

a) 1 b) 2 c) 3 d) 4

8. Garbage Collection was invented by:

a) John McCarthy b) James Ghosling c) ScottGu d) Jerry Yang

9. Which part of the memory is involved in garbage collection?

a) Stack b) Heap c) Both d) None

10. What controls the garbage collector in java?

a) JDK b) JNA c) Dojo d) JVM


11. An object become eligible for garbage collection

a) Everytime b) During Compilation c) WhenNo live thread can access it d) Never

12. Which of the following method is used to explicitly call garbage collector in java?

a) Runtime.getRuntime().gc() b) System.GC. c) System.GC.Garbage d) Both a & b

13. In java How many times does the garbage collector calls the finalize() method for an object?

a) Only Once b) Twice c) Thrice d) Never

14. In .Net which is raised when a garbage collection is about to occur.

a) GCExec_v1 b) GCRun_v1 c) GCStart_v1 d)GCOccur_v1

15. Generation 0 of Garbage collection contains ___ objects.

a)Short-Lived b) Long-Lived c) Temporary d) None

You might also like