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