1.
.Net Garbage collector object collection is
Correct Answer
B. Non-deterministic
Explanation
The correct answer is non-deterministic because the .Net Garbage Collector does not follow a fixed schedule for object collection. Instead, it runs in the background and collects objects that are no longer in use whenever it determines that there is a need for memory reclamation. The exact timing of when the garbage collector runs and which objects it collects is not predictable or predetermined, making it non-deterministic.
2.
Which of these events will not cause the triggering of garbage Collection?
Correct Answer
D. Generation 1 is full
Explanation
Generation 1 is full will not cause the triggering of garbage collection. Garbage collection is triggered when a generation is full and needs to be collected. Generation 0 and Generation 1 are lower generations and when they become full, garbage collection is triggered. Additionally, AppDomain unloading or CLR shutdown can also trigger garbage collection. Explicit calls to the garbage collector collect method can be used to manually trigger garbage collection. However, when only Generation 1 is full, it does not meet the criteria for garbage collection to be triggered.
3.
MS.Net generational garbage collector supports _ generations.
Correct Answer
C. 3
Explanation
The correct answer is 3 because the generational garbage collector in MS.Net supports three generations. This means that objects in memory are divided into three generations based on their age. The garbage collector prioritizes the collection of objects in younger generations, as they are more likely to be eligible for garbage collection. The older generations are collected less frequently. This approach helps improve the efficiency of garbage collection and overall performance of the application.
4.
An object with finalizer will require minimum _ garbage collection cycles to be collected
Correct Answer
B. 2
Explanation
An object with a finalizer will require a minimum of 2 garbage collection cycles to be collected. This is because the first garbage collection cycle will identify the object as eligible for garbage collection, but it will not immediately collect it. Instead, it will enqueue the object for finalization and mark it as finalized. The second garbage collection cycle will then collect the object and free its memory.
5.
Which of the following statement is false regarding C# using statement?
Correct Answer
B. Depends on the object finalize method
Explanation
The statement "Depends on the object finalize method" is false regarding the C# using statement. The using statement is used for deterministically cleaning up the object, meaning it ensures that the object is properly disposed of after it is no longer needed. It depends on the object implementing the IDisposable interface, not on the object's finalize method. The using statement can be used with both reference types and value types in C#.
6.
Which of the following statement is true regarding Garbage Collector?
Correct Answer
C. It is a self optimizing Garbage Collector
Explanation
The statement that the Garbage Collector is a self-optimizing Garbage Collector means that it has the ability to automatically adjust its behavior and optimize its performance based on the current state of the application and the available system resources. This allows the Garbage Collector to dynamically adapt its memory management strategies and allocation policies to improve overall application performance and memory usage efficiency.
7.
Which one of the following can not be a root for Garbage collector?
Correct Answer
C. Native win32 Handles
Explanation
Native win32 Handles cannot be roots for the Garbage collector because they are external resources managed by the operating system, not by the garbage collector. The garbage collector is responsible for managing memory and objects within the application, but it does not have control over external resources like native win32 handles. Therefore, native win32 handles cannot be tracked or managed by the garbage collector.
8.
Which of the following statement is true regarding .Net Automatic Memory Management?
Correct Answer
D. It takes away all kind of Windows resource management from developer
Explanation
The correct answer is "It takes away all kind of Windows resource management from developer". This statement suggests that .Net Automatic Memory Management handles all aspects of Windows resource management, relieving the developer from having to manually manage these resources. This includes preventing memory leaks and managing native Windows resources using finalize and dispose patterns.
9.
Which of the following is not a static method of GC class?
Correct Answer
C. RegisterFinalize
Explanation
The method RegisterFinalize is not a static method of the GC class. The GC class in .NET provides functionality for garbage collection, and it includes static methods like SuppressFinalize, ReRegisterForFinalize, and Collect. However, there is no method called RegisterFinalize in the GC class.