C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
A developer implements IComparable interface in a Student class. What must the class implement?
What will happen if you try to override a non-virtual method in a derived class in C#?
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?
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();
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?
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);
A payment processing system implements multiple interfaces: IPayment, IRefundable, IAuditTrail. A PaymentProcessor class must implement all three. Which statement is true?
Which of the following best describes the 'this' keyword in C#?
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?
What is the primary purpose of ASP.NET in web development?
Which of the following is the latest version of ASP.NET as per 2024-2025?
What does CLR stand for in the context of .NET?
In ASP.NET, what is the purpose of the Global.asax file?
Which attribute is used to mark a method as an HTTP endpoint in ASP.NET Core?
What is the difference between ASP.NET Framework and ASP.NET Core?
Which of the following is NOT a built-in state management technique in ASP.NET?
What is the role of Middleware in ASP.NET Core?
In an ASP.NET Core application, where is Dependency Injection configured?
What is the purpose of the [ValidateAntiForgeryToken] attribute in ASP.NET MVC?
Which of the following methods is used to pass data from Controller to View in ASP.NET MVC?