.NET Programming MCQs with answers Page - 53

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

A

Admin • 833.24K Points
Coach

Q. What will be printed?

Code:
try
{
    int x = int.Parse("abc");
}
catch(Exception)
{
    Console.WriteLine("Error");
}
  • (A) abc
  • (B) 0
  • (C) Compilation error
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to stop method overriding?

  • (A) sealed
  • (B) override
  • (C) abstract
  • (D) static

A

Admin • 833.24K Points
Coach

Q. What will be the output?

Code:
var list = new List<int>{1,2,3};
list.Remove(2);
Console.WriteLine(list.Count);
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 0

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to handle exceptions?

  • (A) handle
  • (B) error
  • (C) try
  • (D) check

A

Admin • 833.24K Points
Coach

Q. What will be the output?

Code:
bool result = string.IsNullOrEmpty("");
Console.WriteLine(result);
  • (A) True
  • (B) False
  • (C) null
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Which interface supports LINQ?

  • (A) IList
  • (B) ICollection
  • (C) IEnumerable
  • (D) IDictionary

A

Admin • 833.24K Points
Coach

Q. What will be printed?

Code:
int x = 0;
while(x < 3)
{
    x++;
}
Console.WriteLine(x);
  • (A) 2
  • (B) 3
  • (C) 4
  • (D) 0

A

Admin • 833.24K Points
Coach

Q. Which service lifetime creates one instance per request in ASP.NET Core?

  • (A) Singleton
  • (B) Transient
  • (C) Scoped
  • (D) Static

A

Admin • 833.24K Points
Coach

Q. Which keyword is used to create an object in C#?

  • (A) create
  • (B) new
  • (C) object
  • (D) alloc

A

Admin • 833.24K Points
Coach

Q. What will be the output?

Code:
int x = 3;
Console.WriteLine(x * x);
  • (A) 6
  • (B) 9
  • (C) 3
  • (D) Compilation error

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