iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.41Medium

A student management system implements IComparable<Student> to sort students. Which method must be implemented?

Q.42Medium

What happens when a derived class constructor does not explicitly call the base class constructor in C#?

Q.43Medium

In a company payroll system, Employee is the base class with CalculateSalary() as virtual method. Manager and Intern classes override it differently. Why is this design preferred?

Q.44Medium

Which statement about abstract classes in C# is INCORRECT?

Q.45Medium

What is the output of the following C# code? class Base { public virtual void Display() { Console.WriteLine("Base"); } } class Derived : Base { public override void Display() { Console.WriteLine("Derived"); } } Base obj = new Derived(); obj.Display();

Q.46Medium

Which keyword in C# is used to prevent a class from being inherited?

Q.47Medium

What will be the result of the following C# code? class Animal { } class Dog : Animal { } Dog dog = new Animal(); // Line 1

Q.48Medium

Which of the following correctly demonstrates composition in C#?

Q.49Medium

In a banking application, you need to create a base class that cannot be instantiated but defines common properties for SavingsAccount and CheckingAccount. Which should you use?

Q.50Medium

In a logistics system, both Truck and Bicycle need to calculate delivery cost. Instead of duplicating code, you decide to use an interface. What advantage does this provide?

Q.51Medium

In a real-time inventory management system, a Product class needs to track stock levels that should not be modified directly from outside the class. Which OOP principle should be applied here, and how?

C# Programming MCQs – Free Practice Tests | iGET | iGET