MCQs on C# and the .NET Framework | C#

Chapter 14 of C# and the .NET Framework covers key concepts like the .NET Framework, .NET Core, CLR, Assemblies, Namespaces, Garbage Collection, and Application Domains. Here are 30 MCQs to test your knowledge on these topics:

Understanding .NET Framework and .NET Core

  1. What is the main difference between .NET Framework and .NET Core? a) .NET Framework is cross-platform
    b) .NET Core is for Windows only
    c) .NET Core is cross-platform
    d) .NET Framework supports only 32-bit systems
  2. Which of the following is NOT a feature of .NET Core? a) Cross-platform compatibility
    b) Open-source
    c) Closed source
    d) Supports microservices
  3. What does the term “cross-platform” in .NET Core imply? a) It runs only on Linux
    b) It can run on multiple operating systems
    c) It is limited to Windows
    d) It only supports 64-bit systems
  4. Which of the following components is shared by both .NET Framework and .NET Core? a) Common Language Runtime (CLR)
    b) Only Windows API
    c) Visual Studio IDE
    d) .NET runtime
  5. Which platform can you use to develop applications using .NET Core? a) Only Windows
    b) Only Linux
    c) Windows, Linux, macOS
    d) Only macOS

Common Language Runtime (CLR)

  1. What is the role of the Common Language Runtime (CLR)? a) Manage memory only
    b) Run and manage code execution
    c) Compile code to native machine code
    d) Control the operating system
  2. Which of the following is a responsibility of the CLR in .NET? a) Memory management
    b) Error handling
    c) Code access security
    d) All of the above
  3. Which of the following does the CLR provide for .NET applications? a) Automatic memory allocation
    b) Manual memory management
    c) Only garbage collection
    d) Application-level security
  4. How does CLR handle type safety? a) By executing unverified code
    b) By using the type information at runtime
    c) By allowing any type of object
    d) By ignoring type definitions
  5. Which of the following is used by CLR to ensure type safety in .NET programs? a) Just-in-time compilation
    b) Common Type System (CTS)
    c) Interoperability
    d) Common Language Specification (CLS)

Assemblies and Namespaces

  1. What is an assembly in .NET? a) A collection of namespaces
    b) A unit of deployment and versioning
    c) A type of database
    d) A method to organize memory
  2. Which of the following is true about assemblies in .NET? a) Assemblies can only be created in Visual Studio
    b) Assemblies are automatically compiled by the CLR
    c) Assemblies can include metadata and resources
    d) Assemblies are not versioned
  3. How does a namespace help in a .NET application? a) Organizes the memory usage
    b) Defines access control
    c) Organizes types like classes and interfaces
    d) Sets the security for an assembly
  4. Which of the following is NOT a type of assembly in .NET? a) Private assemblies
    b) Shared assemblies
    c) Mixed assemblies
    d) Dynamic-link assemblies
  5. What is the purpose of the Global Assembly Cache (GAC)? a) To store only private assemblies
    b) To store reusable assemblies
    c) To cache runtime data
    d) To compile assembly code

Garbage Collection

  1. What is the purpose of garbage collection in .NET? a) Collecting data from users
    b) Releasing unused memory
    c) Enhancing CPU performance
    d) Managing network resources
  2. Which of the following is NOT a part of the garbage collection process? a) Identifying objects no longer in use
    b) Moving objects to different memory segments
    c) Manual memory deallocation
    d) Releasing unused memory back to the system
  3. How does the garbage collector determine when an object is no longer in use? a) By checking if the object is in a “finalizer” queue
    b) By checking object references
    c) By checking the object’s size
    d) By checking the object’s execution time
  4. When does the garbage collector typically run? a) Every time the program runs
    b) When memory is low
    c) At regular intervals
    d) Only when the application crashes
  5. Which of the following is true about garbage collection in .NET? a) It is entirely manual
    b) It requires explicit memory management
    c) It operates in the background automatically
    d) It does not free memory

Application Domain

  1. What is the purpose of an application domain in .NET? a) To isolate applications for security and stability
    b) To store data and configurations
    c) To load and execute assemblies
    d) To manage the user interface
  2. How does an application domain provide isolation? a) By preventing access to external resources
    b) By isolating memory usage for each app
    c) By encrypting code
    d) By limiting network communication
  3. Which of the following is NOT a benefit of using application domains? a) Isolation of execution
    b) Cross-platform support
    c) Domain-level security
    d) Easy assembly unloading
  4. How are application domains related to the CLR? a) CLR handles application domain creation
    b) CLR cannot handle application domains
    c) Application domains are external to CLR
    d) CLR runs only in a single application domain
  5. What is the default application domain created by the CLR called? a) Main Domain
    b) Root Domain
    c) Default Domain
    d) System Domain
  6. Which of the following can be created within an application domain? a) A new process
    b) A new thread
    c) A new object instance
    d) A new assembly
  7. What happens when an application domain is unloaded? a) The application terminates
    b) All code in the domain is destroyed
    c) Only memory is released
    d) The application is suspended
  8. Which of the following can be an effect of an application domain crash? a) The whole system crashes
    b) Only the specific application domain is affected
    c) Other application domains will be stopped
    d) It causes memory leaks
  9. What can be used to manage application domains in .NET? a) AppDomain class
    b) Assembly class
    c) Namespace class
    d) CLR class
  10. Which of the following best describes the relationship between an application domain and an assembly? a) An assembly is always bound to a specific application domain
    b) Assemblies are shared across all application domains
    c) Assemblies cannot be used across application domains
    d) Application domains are loaded within assemblies

Answer Key

QnoAnswer (Option with Text)
1c) .NET Core is cross-platform
2c) Closed source
3b) It can run on multiple operating systems
4a) Common Language Runtime (CLR)
5c) Windows, Linux, macOS
6b) Run and manage code execution
7d) All of the above
8a) Automatic memory allocation
9b) By using the type information at runtime
10b) Common Type System (CTS)
11b) A unit of deployment and versioning
12c) Assemblies can include metadata and resources
13c) Organizes types like classes and interfaces
14c) Mixed assemblies
15b) To store reusable assemblies
16b) Releasing unused memory
17c) Manual memory deallocation
18b) By checking object references
19b) When memory is low
20c) It operates in the background automatically
21a) To isolate applications for security and stability
22b) By isolating memory usage for each app
23b) Cross-platform support
24a) CLR handles application domain creation
25c) Default Domain
26c) A new object instance
27b) All code in the domain is destroyed
28b) Only the specific application domain is affected
29a) AppDomain class
30a) An assembly is always bound to a specific application domain

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top