Quiz-memory Management In Microsoft.Net

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Sarvesh
S
Sarvesh
Community Contributor
Quizzes Created: 9 | Total Attempts: 71,289
Questions: 9 | Attempts: 762

SettingsSettingsSettings
Quiz-memory Management In Microsoft.Net - Quiz

The quiz test your knowledge of. Net Memory Management concepts.


Questions and Answers
  • 1. 

    .Net Garbage collector object collection is

    • A.

      Deterministic

    • B.

      Non-deterministic

    • C.

      Opportunistic

    • D.

      Predictive

    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.

    Rate this question:

  • 2. 

    Which of these events will not cause the triggering of garbage Collection?

    • A.

      Generation 0 is full

    • B.

      AppDomain unloading or CLR shutdown

    • C.

      Explicit calls to Garbage Collector collect method

    • D.

      Generation 1 is full

    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.

    Rate this question:

  • 3. 

    MS.Net generational garbage collector supports _ generations.

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    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.

    Rate this question:

  • 4. 

    An object with finalizer will require minimum _ garbage collection cycles to be collected

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    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.

    Rate this question:

  • 5. 

    Which of the following statement is false regarding C# using statement?

    • A.

      Used for deterministically cleaning up the object

    • B.

      Depends on the object finalize method

    • C.

      Depends on the object implementing IDisposable interface

    • D.

      Can be used with value type as well

    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#.

    Rate this question:

  • 6. 

    Which of the following statement is true regarding Garbage Collector?

    • A.

      It uses a fix quota of memory for different generation

    • B.

      The algorithm used by GC is configurable by administrator

    • C.

      It is a self optimizing Garbage Collector

    • D.

      Calling GC.Collect will immediate start garbage Collection

    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.

    Rate this question:

  • 7. 

    Which one of the following can not be a root for Garbage collector?

    • A.

      Static fields

    • B.

      Method Parameter

    • C.

      Native win32 Handles

    • D.

      Local Variables

    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.

    Rate this question:

  • 8. 

    Which of the following statement is true regarding .Net Automatic Memory Management?

    • A.

      This eliminates the leakage of managed memory.

    • B.

      It takes away memory management task from developer.

    • C.

      It prevents leaking native Windows resources using finalize and dispose pattern

    • D.

      It takes away all kind of Windows resource management from developer

    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.

    Rate this question:

  • 9. 

    Which of the following is not a static method of GC class?

    • A.

      SuppressFinalize

    • B.

      ReRegisterForFinalize

    • C.

      RegisterFinalize

    • D.

      Collect

    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.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 28, 2008
    Quiz Created by
    Sarvesh
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.