.net banner

.NET Multiple Choice Questions (MCQs) and Answers

Master .NET with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of .NET concepts. Begin your placement preparation journey now!

Q1

Q1 What is the primary purpose of the .NET Framework?

A

To provide tools for building mobile apps

B

To build web apps only

C

To develop Windows apps in multiple languages

D

To design animations

Q2

Q2 Which of these is a component of the .NET Framework?

A

Common Language Runtime (CLR)

B

Java Runtime Environment

C

Python Interpreter

D

Linux Kernel

Q3

Q3 What is MSIL in the context of .NET?

A

Machine-Specific Intermediate Language

B

Managed Source Intermediate Language

C

Microsoft Intermediate Language

D

Microsoft Secure Intermediate Language

Q4

Q4 Which programming languages are supported by the .NET Framework?

A

Only C++

B

Java and C#

C

C#, VB.NET, F#

D

JavaScript and Python

Q5

Q5 What does the .exe file represent in a .NET application?

A

Source code file

B

Executable file

C

Assembly cache

D

Code library

Q6

Q6 Which of the following describes the .NET Framework Class Library?

A

A runtime environment

B

A collection of reusable classes

C

A file manager

D

A code editor

Q7

Q7 Which framework version introduced .NET Core as cross-platform?

A

.NET 3.5

B

.NET 4.0

C

.NET 5

D

.NET Core

Q8

Q8 Which tool can be used to compile .NET applications?

A

JDK

B

MSBuild

C

Node.js

D

PHP

Q9

Q9 Which method displays text on the console in C#?

A

Console.Display()

B

Console.Output()

C

Console.WriteLine()

D

Console.Print()

Q10

Q10 A developer encounters a "FileNotFoundException" in .NET. What is the likely issue?

A

File is corrupted

B

Incorrect file path

C

Incorrect framework version

D

Database is down

Q11

Q11 What is the main function of the Common Language Runtime (CLR) in .NET?

A

Manages app updates

B

Executes code and manages memory

C

Controls database access

D

Designs UI

Q12

Q12 What is the purpose of the Common Type System (CTS) in .NET?

A

Defines types for cross-language compatibility

B

Handles memory allocation

C

Sets up permissions

D

Compiles code

Q13

Q13 Which component of .NET is responsible for garbage collection?

A

Framework Class Library

B

Common Language Runtime

C

Global Assembly Cache

D

Intermediate Language Compiler

Q14

Q14 Which .NET component compiles managed code into native code?

A

Intermediate Language Compiler

B

Common Type System

C

JIT Compiler

D

Framework Library

Q15

Q15 What is the purpose of the .NET Framework Class Library (FCL)?

A

Executes code

B

Manages user access

C

Provides reusable classes

D

Compiles programs

Q16

Q16 Which .NET feature allows multiple languages to be used in a single application?

A

Cross-Platform Support

B

Interoperability

C

Common Language Specification

D

Multi-Threading

Q17

Q17 What does the Global Assembly Cache (GAC) do in .NET?

A

Manages memory

B

Stores temporary files

C

Hosts shared assemblies

D

Compiles code

Q18

Q18 Which code snippet demonstrates defining an integer variable in C#?

A

int number = 10;

B

number = 10;

C

int number

D

number = 10

Q19

Q19 Which command can be used to add an assembly to the Global Assembly Cache (GAC) in .NET?

A

gacutil -i assembly

B

install -gac assembly

C

gac -add assembly

D

addgac assembly

Q20

Q20 A developer encounters a "Type Mismatch" error. What is the likely cause?

A

Incorrect type declaration

B

Syntax error

C

File path issue

D

Invalid characters

Q21

Q21 An application fails due to a missing assembly. What is a possible solution?

A

Rebuild the project

B

Reinstall the GAC

C

Recompile the assembly

D

Check system path

Q22

Q22 What is the main purpose of the Common Language Runtime (CLR) in .NET?

A

To compile Java code

B

To provide debugging features

C

To manage program execution

D

To replace the OS

Q23

Q23 Which part of the CLR is responsible for memory management?

A

Common Type System

B

JIT Compiler

C

Garbage Collector

D

Global Assembly Cache

Q24

Q24 Which type of code does the CLR execute?

A

Managed code

B

Machine code

C

Assembly code

D

Source code

Q25

Q25 What is the purpose of the Just-In-Time (JIT) compiler in CLR?

A

To manage memory

B

To interpret code

C

To convert MSIL to machine code

D

To secure the OS

Q26

Q26 Which CLR feature ensures that objects are automatically deleted when they are no longer referenced?

A

JIT Compilation

B

Garbage Collection

C

Exception Handling

D

Threading

Q27

Q27 Which process in the CLR allows code to be verified for type safety before execution?

A

Code Access Security

B

Garbage Collection

C

Code Verification

D

Just-In-Time Compilation

Q28

Q28 How do you force garbage collection in a .NET application?

A

GC.Run()

B

Garbage.Collect()

C

System.GC()

D

CLR.Collect()

Q29

Q29 Which method would you use to determine the generation of an object in .NET?

A

GC.GetGeneration(object)

B

GC.Collect()

C

GC.Generation()

D

GC.GetGen(object)

Q30

Q30 A developer encounters an "OutOfMemoryException." What could be a likely cause?

A

File not found

B

Corrupt CLR

C

Too many objects in memory

D

Invalid file path

ad verticalad vertical
ad