iGET

C# Programming - MCQ Practice Questions

C# (.NET) MCQs — OOP, collections, LINQ & exception handling.

290 questions | 100% Free

Q.161Medium

A developer implements IComparable interface in a Student class. What must the class implement?

Q.162Hard

What will happen if you try to override a non-virtual method in a derived class in C#?

Q.163Hard

A banking application uses inheritance where Account is the parent class and SavingsAccount, CurrentAccount are derived classes. Each has different withdrawal rules. Which design principle is being followed?

Q.164Medium

What is the correct order of constructor execution in multilevel inheritance? class A { public A() { Console.WriteLine("A"); } } class B : A { public B() { Console.WriteLine("B"); } } class C : B { public C() { Console.WriteLine("C"); } } new C();

Q.165Medium

An e-commerce system needs to ensure that a Product class cannot be instantiated directly but can be inherited. Additionally, it must define some concrete methods and some abstract methods. Which approach is best?

Q.166Easy

What is the output of this C# code? public class Employee { private string name = "John"; public Employee(string n) { name = n; } } Employee emp = new Employee("Alice"); Console.WriteLine(emp.name);

Q.167Medium

A payment processing system implements multiple interfaces: IPayment, IRefundable, IAuditTrail. A PaymentProcessor class must implement all three. Which statement is true?

Q.168Easy

Which of the following best describes the 'this' keyword in C#?

Q.169Hard

In a hospital management system, Doctor and Nurse classes need to perform a common Logout() operation but have different Login() procedures. What is the best OOP approach?

Q.170Easy

What is the primary purpose of ASP.NET in web development?

Q.171Easy

Which of the following is the latest version of ASP.NET as per 2024-2025?

Q.172Easy

What does CLR stand for in the context of .NET?

Q.173Medium

In ASP.NET, what is the purpose of the Global.asax file?

Q.174Medium

Which attribute is used to mark a method as an HTTP endpoint in ASP.NET Core?

Q.175Medium

What is the difference between ASP.NET Framework and ASP.NET Core?

Q.176Medium

Which of the following is NOT a built-in state management technique in ASP.NET?

Q.177Medium

What is the role of Middleware in ASP.NET Core?

Q.178Medium

In an ASP.NET Core application, where is Dependency Injection configured?

Q.179Medium

What is the purpose of the [ValidateAntiForgeryToken] attribute in ASP.NET MVC?

Q.180Medium

Which of the following methods is used to pass data from Controller to View in ASP.NET MVC?