.NET Programming MCQs with answers Page - 38

Here, you will find a collection of MCQ questions on .NET Programming. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which GC generation in .NET holds long-lived objects?

  • (A) Generation 0
  • (B) Generation 1
  • (C) Generation 2
  • (D) Pinned Heap

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is contained in the `.runtimeconfig.json` file?

  • (A) Only NuGet package paths
  • (B) Runtime settings and version info
  • (C) List of dependencies
  • (D) Source file locations

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which runtime feature ensures applications do not access unauthorized memory?

  • (A) Reflection
  • (B) Memory pooling
  • (C) Type safety
  • (D) JIT optimization

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is the primary role of the CLI tool `dotnet test`?

  • (A) Publish test logs
  • (B) Run unit tests in a project
  • (C) Create a test project
  • (D) Configure test coverage rules

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which file defines package references in .NET Core?

  • (A) app.config
  • (B) nuget.config
  • (C) *.csproj
  • (D) web.config

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which statement about .NET GC generations is correct?

  • (A) All objects are allocated in Gen2 first
  • (B) Gen1 is the youngest generation
  • (C) Gen0 collects short-lived objects
  • (D) Gen2 is collected most frequently

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which feature allows examining metadata about assemblies at runtime?

  • (A) Dependency injection
  • (B) Reflection
  • (C) Encapsulation
  • (D) GC Compaction

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which tool compiles IL into native code during deployment?

  • (A) dotnet build
  • (B) ngen.exe
  • (C) dotnet publish
  • (D) csc.exe

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which .NET CLI command creates a new class library project?

  • (A) dotnet new classlib
  • (B) dotnet build classlib
  • (C) dotnet lib create
  • (D) dotnet generate lib

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which of the following is true about the .NET JIT compiler?

  • (A) It compiles source code directly to native
  • (B) It runs before the program starts
  • (C) It compiles IL to native at runtime
  • (D) It produces only bytecode