A student management system implements IComparable<Student> to sort students. Which method must be implemented?
Q.82Medium
What happens when a derived class constructor does not explicitly call the base class constructor in C#?
Q.83Medium
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.84Medium
Which statement about abstract classes in C# is INCORRECT?
Q.85Hard
A gaming application needs to implement different weapons (Sword, Gun, Bow) with different attack methods. Which approach is most maintainable?
Advertisement
Q.86Hard
In a complex system where a class needs to inherit from multiple sources of functionality while maintaining a single base type, which C# feature is most appropriate?
Q.87Hard
A financial system implements IEquatable<Account> for comparing accounts. What is the primary benefit of implementing this interface?
Q.88Hard
In a real estate system, consider Property (base) with House and Apartment (derived). If Property has a sealed method CalculateTax(), what happens in House class?
Q.89Medium
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.90Easy
In C#, what is the primary purpose of using an interface?
Q.91Medium
Which keyword in C# is used to prevent a class from being inherited?
Q.92Medium
What will be the result of the following C# code?
class Animal { }
class Dog : Animal { }
Dog dog = new Animal(); // Line 1
Q.93Medium
Which of the following correctly demonstrates composition in C#?
Q.94Medium
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.95Medium
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.96Easy
Which statement is TRUE about abstract methods in C#?
Q.97Hard
Consider a scenario where class X implements interfaces IA and IB, and both interfaces have a method named Process(). How should X implement this?
Q.98Hard
In a healthcare system, Doctor is a derived class from Employee. If you want to ensure that Doctor's constructor calls Employee's constructor before executing, which approach is correct?
Q.99Medium
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?
Q.100Easy
Consider a payment processing system where PaymentProcessor is an abstract class with an abstract method ProcessPayment(). CreditCardProcessor and UPIProcessor are derived classes. What will happen if you try to instantiate PaymentProcessor directly in C#?