Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: Yes, methods can have default implementations in interfaces. interface ILogger { void Log(string message); void LogWarning(string message) => Console.WriteLine("Warning: " + message); } What interviewers e…
Feature Interface Class Implementatio No implementation (except default methods) Can have full implementation Fields Cannot have fields Can have fields Instantiation Cannot instantiate Can instantiate Inheritance Can inh…
Answer: Yes, a class can implement multiple interfaces, solving multiple inheritance issues. class FlyingCar : IDriveable, IFlyable { public void Drive() => Console.WriteLine("Driving"); public void Fly() =&gt…
Answer: The implementing class must provide a single implementation for both interfaces. Or use explicit interface implementation to differentiate. What interviewers expect A clear definition tied to OOP in C# OOP projec…
Answer: Yes, explicit implementation allows a class to implement interface members separately. class Car : IDriveable { void IDriveable.Drive() => Console.WriteLine("Explicit drive"); } What interviewers expect A…
Answer: Implementing an interface member explicitly so it can only be called via interface reference, not class object. IDriveable car = new Car(); car.Drive(); // Works // Car c = new Car(); c.Drive(); // Won't compile…
Answer: Define contracts for classes. Achieve abstraction, polymorphism, and loose coupling. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performance, maintainability, security,…
Answer: Expose method signatures without implementation. Users interact with the interface, not the underlying implementation. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (perfor…
Answer: Code depends on interface, not concrete class. Makes it easier to swap implementations without changing dependent code. void StartVehicle(IDriveable vehicle) { vehicle.Drive(); } What interviewers expect A clear…
Interfaces allow DI frameworks to inject concrete implementations at runtime. Promotes flexibility and testability. public class CarService { private readonly IDriveable _vehicle; public CarService(IDriveable vehicle) {…
Answer: Provides a standard method to compare objects for sorting. class Employee : IComparable<Employee> { public int Id { get; set; } public int CompareTo(Employee other) => this.Id.CompareTo(other…
Answer: Provides Dispose() method for releasing unmanaged resources. class FileHandler : IDisposable { public void Dispose() => Console.WriteLine("Resources released"); } What interviewers expect A clear definitio…
Answer: IEnumerable → Provides collection traversal capability (GetEnumerator() method). IEnumerator → Used to iterate over a collection (MoveNext(), Current, Reset()). What interviewers expect A clear definition tied to…
Answer: Yes, interfaces can inherit from other interfaces, forming a hierarchy. interface IFlyable { void Fly(); } interface IAdvancedFlyable : IFlyable { void Loop(); } What interviewers expect A clear definition tied t…
Answer: Interfaces with no methods or properties, used to mark classes for special behavior. Example: ISerializable marks classes as serializable. What interviewers expect A clear definition tied to OOP in C# OOP project…
Answer: An abstract class is a class that cannot be instantiated directly. Can contain abstract methods (without implementation) and concrete methods (with implementation). Used to define a common base for other classes.…
Answer: Use the abstract keyword. bstract class Vehicle { public abstract void Start(); public void Stop() => Console.WriteLine("Vehicle stopped"); } What interviewers expect A clear definition tied to OOP in C# O…
A method declared with abstract without implementation. Must be overridden in a derived class. bstract class Vehicle { public abstract void Start(); } class Car : Vehicle { public override void Start() => Console.Writ…
Answer: Yes, abstract classes can have fields, properties, and constants. bstract class Vehicle { protected string Brand; } What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performan…
Yes, abstract classes can implement interfaces partially or fully. Derived classes must implement any remaining abstract members. interface IDriveable { void Drive(); } bstract class Vehicle : IDriveable { public abstrac…
Answer: No, abstract classes cannot be sealed. A sealed class cannot be inherited, while abstract classes are meant to be inherited. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (…
Answer: Yes, abstract classes can have private members, but derived classes cannot ccess them. Private members can be accessed via protected or public methods. What interviewers expect A clear definition tied to OOP in C…
Answer: No, a class cannot be both abstract and static. Abstract classes are for inheritance, static classes cannot be inherited. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (per…
llow derived class to optionally override What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performance, maintainability, security, cost) When you would and would not use it in produc…
Feature Abstract Method Virtual Method Implementatio No implementation Has implementation Must override? Must be overridden Optional to override Class type Must be in abstract class Can be in any class Purpose Force deri…
C# OOP C# Programming Tutorial · OOP
Answer: Yes, methods can have default implementations in interfaces. interface ILogger { void Log(string message); void LogWarning(string message) => Console.WriteLine("Warning: " + message); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Feature Interface Class
Implementatio
No implementation (except default
methods)
Can have full
implementation
Fields Cannot have fields Can have fields
Instantiation Cannot instantiate Can instantiate
Inheritance Can inherit multiple interfaces Single class inheritance only
C# OOP C# Programming Tutorial · OOP
Answer: Yes, a class can implement multiple interfaces, solving multiple inheritance issues. class FlyingCar : IDriveable, IFlyable { public void Drive() => Console.WriteLine("Driving"); public void Fly() => Console.WriteLine("Flying"); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: The implementing class must provide a single implementation for both interfaces. Or use explicit interface implementation to differentiate.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Yes, explicit implementation allows a class to implement interface members separately. class Car : IDriveable { void IDriveable.Drive() => Console.WriteLine("Explicit drive"); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Implementing an interface member explicitly so it can only be called via interface reference, not class object. IDriveable car = new Car(); car.Drive(); // Works // Car c = new Car(); c.Drive(); // Won't compile
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Define contracts for classes. Achieve abstraction, polymorphism, and loose coupling.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Expose method signatures without implementation. Users interact with the interface, not the underlying implementation.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Code depends on interface, not concrete class. Makes it easier to swap implementations without changing dependent code. void StartVehicle(IDriveable vehicle) { vehicle.Drive(); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
public class CarService
{
private readonly IDriveable _vehicle;
public CarService(IDriveable vehicle) { _vehicle = vehicle; }
}C# OOP C# Programming Tutorial · OOP
Answer: Provides a standard method to compare objects for sorting. class Employee : IComparable<Employee> { public int Id { get; set; } public int CompareTo(Employee other) => this.Id.CompareTo(other.Id); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Provides Dispose() method for releasing unmanaged resources. class FileHandler : IDisposable { public void Dispose() => Console.WriteLine("Resources released"); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: IEnumerable → Provides collection traversal capability (GetEnumerator() method). IEnumerator → Used to iterate over a collection (MoveNext(), Current, Reset()).
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Yes, interfaces can inherit from other interfaces, forming a hierarchy. interface IFlyable { void Fly(); } interface IAdvancedFlyable : IFlyable { void Loop(); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Interfaces with no methods or properties, used to mark classes for special behavior. Example: ISerializable marks classes as serializable.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: An abstract class is a class that cannot be instantiated directly. Can contain abstract methods (without implementation) and concrete methods (with implementation). Used to define a common base for other classes.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Use the abstract keyword. bstract class Vehicle { public abstract void Start(); public void Stop() => Console.WriteLine("Vehicle stopped"); }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
bstract class Vehicle
{
public abstract void Start();
}
class Car : Vehicle
{
public override void Start() => Console.WriteLine("Car
started");
}C# OOP C# Programming Tutorial · OOP
Answer: Yes, abstract classes can have fields, properties, and constants. bstract class Vehicle { protected string Brand; }
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
interface IDriveable { void Drive(); }
bstract class Vehicle : IDriveable { public abstract void Drive();
}
class Car : Vehicle { public override void Drive() =>
Console.WriteLine("Car drives"); }
C# OOP C# Programming Tutorial · OOP
Answer: No, abstract classes cannot be sealed. A sealed class cannot be inherited, while abstract classes are meant to be inherited.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: Yes, abstract classes can have private members, but derived classes cannot ccess them. Private members can be accessed via protected or public methods.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Answer: No, a class cannot be both abstract and static. Abstract classes are for inheritance, static classes cannot be inherited.
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
llow derived class to optionally override
In a production C# OOP application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
C# OOP C# Programming Tutorial · OOP
Feature Abstract Method Virtual Method
Implementatio
No implementation Has implementation
Must override? Must be overridden Optional to override
Class type Must be in abstract class Can be in any class
Purpose Force derived classes to
implement
Allow derived class to optionally
override