.NET Programming MCQs with answers Page - 26

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. What is the default scope of a class in C# if no access modifier is provided?

  • (A) public
  • (B) private
  • (C) internal
  • (D) protected

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which LINQ method ensures only unique elements are returned?

  • (A) Distinct()
  • (B) GroupBy()
  • (C) Select()
  • (D) Where()

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which C# keyword is used to define a constant value?

  • (A) final
  • (B) static
  • (C) const
  • (D) readonly

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which HTTP status code indicates 'Not Found'?

  • (A) 200
  • (B) 302
  • (C) 500
  • (D) 404

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is `Tuple.Create()` used for?

  • (A) To create anonymous classes
  • (B) To create reference types
  • (C) To return multiple values from a method
  • (D) To define a struct

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which attribute is used to validate email addresses in a model?

  • (A) [EmailValidator]
  • (B) [Email]
  • (C) [EmailCheck]
  • (D) [EmailAddress]

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which ASP.NET Core middleware handles errors globally?

  • (A) app.UseRouting()
  • (B) app.UseAuthorization()
  • (C) app.UseExceptionHandler()
  • (D) app.UseEndpoints()

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What type of class cannot be instantiated directly?

  • (A) Static
  • (B) Sealed
  • (C) Abstract
  • (D) Internal

R

Ram Sharma • 3.40K Points
Extraordinary

Q. What does `ref` keyword in C# do?

  • (A) Passes value by reference
  • (B) Declares a readonly field
  • (C) Defines a reference type
  • (D) Creates a pointer

R

Ram Sharma • 3.40K Points
Extraordinary

Q. Which of the following statements about static constructors is true?

  • (A) They can take parameters
  • (B) They are called explicitly
  • (C) They run only once per type
  • (D) They can be public

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