.NET Programming MCQs with answers Page - 23

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 .NET Core command creates a new console project?

  • (A) dotnet new mvc
  • (B) dotnet build
  • (C) dotnet new console
  • (D) dotnet run console

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `DbSet<T>` represent in EF Core?

  • (A) A table in the database
  • (B) An in-memory collection
  • (C) A controller
  • (D) A static entity

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is `TempData` used for in ASP.NET MVC?

  • (A) Persist data between requests
  • (B) Store long-term data
  • (C) Pass data from controller to view only
  • (D) Store data across sessions

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is `ModelState.IsValid` used for?

  • (A) Validates view
  • (B) Checks user session
  • (C) Checks if the posted model satisfies validation rules
  • (D) Compares two models

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `async` keyword indicate in C#?

  • (A) That a method returns a void
  • (B) That a method runs synchronously
  • (C) That a method is multithreaded
  • (D) That a method runs asynchronously

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which method runs a middleware component in ASP.NET Core?

  • (A) Use()
  • (B) Add()
  • (C) Inject()
  • (D) Run()

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which pattern is used for Dependency Injection in .NET Core?

  • (A) Factory Pattern
  • (B) Singleton Pattern
  • (C) Inversion of Control
  • (D) Abstract Factory

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `dotnet restore` do?

  • (A) Builds the application
  • (B) Starts the application
  • (C) Restores project dependencies
  • (D) Deletes temp files

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `AddDbContext` method do in .NET Core?

  • (A) Adds a new controller
  • (B) Configures routing
  • (C) Registers EF Core context with DI container
  • (D) Maps URL to View

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does the `sealed` keyword do in C#?

  • (A) Prevents class from being inherited
  • (B) Makes class abstract
  • (C) Allows method overriding
  • (D) Enables dynamic typing

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ