Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Answer: Code depends on interfaces or base classes, not concrete implementations. Makes system flexible, extendable, and easier to maintain. void StartVehicle(Vehicle v) { v.Start(); } // Works with any derived type What…
Answer: Advantages: Promotes code reuse and flexibility Enables loose coupling Supports extensible architecture Disadvantages: May introduce runtime overhead Can make code harder to understand if overused Requires carefu…
Answer: No, interfaces cannot have fields. Only methods, properties, events, or indexers. What interviewers expect A clear definition tied to OOP in C# OOP projects Trade-offs (performance, maintainability, security, cos…
No, interfaces cannot have constructors. 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 product…
Answer: Yes, starting from C# 8, interfaces can contain static methods. interface IUtility { static void Show() => Console.WriteLine("Static method in interface"); } What interviewers expect A clear definition tie…
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…
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: 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: 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: 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…
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…
Answer: Abstract classes can provide shared implementation, fields, and constructors. Useful when multiple classes share common behavior along with enforced bstraction. What interviewers expect A clear definition tied to…
bstract class Employee { public string Name { get; set; } public abstract void Work(); public void Report() => Console.WriteLine("Reporting work done"); } class Developer : Employee { public override void Work() =>…
No, abstract methods must be overridden with override in derived classes. You can then mark the overriding method as virtual to allow further overriding in subclasses. bstract class Vehicle { public abstract void Start()…
No, C# does not allow multiple class inheritance. Use interfaces as a workaround. interface IFlyable { void Fly(); } interface IDriveable { void Drive(); } class FlyingCar : IFlyable, IDriveable { public void Fly() {} pu…
Answer: When you want to define pure contracts without implementation. When you need multiple inheritance. When you want loose coupling for dependency injection. What interviewers expect A clear definition tied to OOP in…
C# OOP C# Programming Tutorial · OOP
Answer: Code depends on interfaces or base classes, not concrete implementations. Makes system flexible, extendable, and easier to maintain. void StartVehicle(Vehicle v) { v.Start(); } // Works with any derived type
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: Advantages: Promotes code reuse and flexibility Enables loose coupling Supports extensible architecture Disadvantages: May introduce runtime overhead Can make code harder to understand if overused Requires careful design to avoid ambiguity
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, interfaces cannot have fields. Only methods, properties, events, or indexers.
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
No, interfaces cannot have constructors.
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, starting from C# 8, interfaces can contain static methods. interface IUtility { static void Show() => Console.WriteLine("Static method in interface"); }
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, 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
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: 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: 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: 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
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
Answer: Abstract classes can provide shared implementation, fields, and constructors. Useful when multiple classes share common behavior along with enforced bstraction.
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 Employee
{
public string Name { get; set; }
public abstract void Work();
public void Report() => Console.WriteLine("Reporting work
done");
}
class Developer : Employee
{
public override void Work() => Console.WriteLine("Writing
code");
}
class Tester : Employee
{
public override void Work() => Console.WriteLine("Testing
pplication");
}
// Usage
Employee dev = new Developer() { Name = "Alice" };
dev.Work();
dev.Report();
C# OOP C# Programming Tutorial · OOP
subclasses.
bstract class Vehicle { public abstract void Start(); }
class Car : Vehicle { public override void Start() =>
Console.WriteLine("Car starts"); }
C# OOP C# Programming Tutorial · OOP
interface IFlyable { void Fly(); }
interface IDriveable { void Drive(); }
class FlyingCar : IFlyable, IDriveable { public void Fly() {} public
void Drive() {} }
Q&A
C# OOP C# Programming Tutorial · OOP
Answer: When you want to define pure contracts without implementation. When you need multiple inheritance. When you want loose coupling for dependency injection.
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.