Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 851–875 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Give an example of abstraction in C#.?

Short answer: Real-World Example: Payment Processing // Abstract class abstract class Payment { public override void Pay(decimal amount) => Console.WriteLine($"Paid {amount:C} using PayPal"); } // Usage Paym…

Mid PDF
How is inheritance implemented in C#?

Short answer: Using the colon (:) symbol. Derived class can access public/protected members of the base class. class Vehicle { public void Start() => Console.WriteLine("Start"); } Example code class Car : Ve…

Mid PDF
Can you inherit multiple classes in C#?

Short answer: No, C# does not support multiple class inheritance to avoid ambiguity. Real-world example (ShopNest) ShopNest has a base PaymentMethod with virtual decimal Fee() . UpiPayment and CardPayment override the fe…

Mid PDF
How does inheritance promote code reusability?

Short answer: Common functionality is implemented in base class. Derived classes reuse the code without duplicating it, reducing maintenance effort. Real-world example (ShopNest) ShopNest has a base PaymentMethod with vi…

Mid PDF
Can a derived class access private members of a base class?

Short answer: No, private members are hidden from derived classes. Can access protected, internal, or public members. class Vehicle { private int id; protected string model; } Example code class Car : Vehicle { /* cannot…

Mid PDF
Can constructors be overloaded?

Short answer: Yes, constructors can have multiple signatures in the same class. class Car Example code { public Car() { } public Car(string model) { } } Real-world example (ShopNest) Think of ShopNest’s Product , Cart ,…

Mid PDF
Can constructors be overridden?

Short answer: No, constructors cannot be inherited or overridden. Base class constructor can be called using : base(), but cannot be overridden. Real-world example (ShopNest) Think of ShopNest’s Product , Cart , and Orde…

Mid PDF
How is polymorphism implemented in C#?

Short answer: How is polymorphism implemented in C#? is a common interview topic in C# OOP. Give a clear definition, then one concrete example. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razo…

Mid PDF
Give an example of polymorphism in C#.?

Short answer: abstract class Shape { public abstract void Draw(); } class Circle : Shape { public override void Draw() => Console.WriteLine("Drawing Circle"); } class Rectangle : Shape { public override void…

Mid PDF
How does polymorphism help in loose coupling?

Short 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 typ…

Mid PDF
What are the advantages and disadvantages of polymorphism?

Short 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…

Mid PDF
Can an interface have fields?

Short answer: No, interfaces cannot have fields. Only methods, properties, events, or indexers. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and Stripe adapters implement the same inte…

Mid PDF
Can an interface have constructors?

Short answer: No, interfaces cannot have constructors. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways wi…

Mid PDF
Can interfaces contain static methods?

Short answer: Yes, starting from C# 8, interfaces can contain static methods. interface IUtility Example code { static void Show() => Console.WriteLine("Static method in interface"); } Real-world example (Sh…

Mid PDF
Can interfaces have default implementations (C# 8+)?

Short answer: Yes, methods can have default implementations in interfaces. interface ILogger Example code { void Log(string message); void LogWarning(string message) => Console.WriteLine("Warning: " + messag…

Mid PDF
Can a class implement multiple interfaces?

Short answer: Yes, a class can implement multiple interfaces, solving multiple inheritance issues. class FlyingCar : IDriveable, IFlyable Example code { public void Drive() => Console.WriteLine("Driving"); p…

Mid PDF
What happens if two interfaces have the same method signature?

Short answer: The implementing class must provide a single implementation for both interfaces. Or use explicit interface implementation to differentiate. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charg…

Mid PDF
Can you implement an interface explicitly?

Short answer: Yes, explicit implementation allows a class to implement interface members separately. class Car : IDriveable Example code { void IDriveable.Drive() => Console.WriteLine("Explicit drive"); } Re…

Mid PDF
How do interfaces help achieve abstraction?

Short answer: Expose method signatures without implementation. Users interact with the interface, not the underlying implementation. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and St…

Mid PDF
How do interfaces support loose coupling?

Short answer: Code depends on interface, not concrete class. Makes it easier to swap implementations without changing dependent code. void StartVehicle(IDriveable vehicle) { vehicle.Drive(); } Real-world example (ShopNes…

Mid PDF
How are interfaces used in dependency injection?

Short answer: Interfaces allow DI frameworks to inject concrete implementations at runtime. Promotes flexibility and testability. public class CarService { private readonly IDriveable _vehicle; public CarService(IDriveab…

Mid PDF
Can one interface inherit another interface?

Short answer: Yes, interfaces can inherit from other interfaces, forming a hierarchy. interface IFlyable { void Fly(); } interface IAdvancedFlyable : IFlyable { void Loop(); } Example code Yes, interfaces can inherit fro…

Mid PDF
What are marker interfaces?

Short answer: Interfaces with no methods or properties, used to mark classes for special behavior. Example: ISerializable marks classes as serializable. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge…

Mid PDF
How do you declare an abstract class in C#?

Short answer: Use the abstract keyword. abstract class Vehicle { Example code public abstract void Start(); public void Stop() => Console.WriteLine("Vehicle stopped"); } Real-world example (ShopNest) Checkou…

Mid PDF
Can abstract classes have fields?

Short answer: Yes, abstract classes can have fields, properties, and constants. abstract class Vehicle { protected string Brand; } Example code Yes, abstract classes can have fields, properties, and constants. abstract c…

C# OOP C# Programming Tutorial · OOP

Short answer: Real-World Example: Payment Processing // Abstract class abstract class Payment { public override void Pay(decimal amount) => Console.WriteLine($"Paid {amount:C} using PayPal"); } // Usage Payment payment1 = new CreditCardPayment(); payment1.Pay(500); payment1.ShowReceipt(500); Payment payment2 = new PayPalPayment(); payment2.Pay(300); payment2.ShowReceipt(300); Explanation: Payment defines what a payment should do…

Explain a bit more

(abstract method Pay). Derived classes (CreditCardPayment, PayPalPayment) define how payment is made. Users interact only with the abstract interface, not the internal logic.

Example code

public abstract void Pay(decimal amount);
public void ShowReceipt(decimal amount) => Console.WriteLine($"Paid: {amount:C}"); } // Derived classes implement abstraction class CreditCardPayment : Payment
{
public override void Pay(decimal amount) => Console.WriteLine($"Paid {amount:C} using Credit Card"); }
class PayPalPayment : Payment
{

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Using the colon (:) symbol. Derived class can access public/protected members of the base class. class Vehicle { public void Start() => Console.WriteLine("Start"); }

Example code

class Car : Vehicle { }
Car myCar = new Car(); myCar.Start(); // Inherited method

Real-world example (ShopNest)

ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: No, C# does not support multiple class inheritance to avoid ambiguity.

Real-world example (ShopNest)

ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Common functionality is implemented in base class. Derived classes reuse the code without duplicating it, reducing maintenance effort.

Real-world example (ShopNest)

ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: No, private members are hidden from derived classes. Can access protected, internal, or public members. class Vehicle { private int id; protected string model; }

Example code

class Car : Vehicle { /* cannot access id, can access model */ }

Real-world example (ShopNest)

ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, constructors can have multiple signatures in the same class. class Car

Example code

{
public Car() { }
public Car(string model) { }
}

Real-world example (ShopNest)

Think of ShopNest’s Product, Cart, and Order classes: each object holds data + behavior, so pricing rules stay next to the data they use.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: No, constructors cannot be inherited or overridden. Base class constructor can be called using : base(), but cannot be overridden.

Real-world example (ShopNest)

Think of ShopNest’s Product, Cart, and Order classes: each object holds data + behavior, so pricing rules stay next to the data they use.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: How is polymorphism implemented in C#? is a common interview topic in C# OOP. Give a clear definition, then one concrete example.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: abstract class Shape { public abstract void Draw(); } class Circle : Shape { public override void Draw() => Console.WriteLine("Drawing Circle"); } class Rectangle : Shape { public override void Draw() => Console.WriteLine("Drawing Rectangle"); } Shape s1 = new Circle();

Example code

Shape s2 = new Rectangle(); s1.Draw(); // Circle's Draw s2.Draw(); // Rectangle's Draw

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short 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

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short 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

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: No, interfaces cannot have fields. Only methods, properties, events, or indexers.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: No, interfaces cannot have constructors.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, starting from C# 8, interfaces can contain static methods. interface IUtility

Example code

{ static void Show() => Console.WriteLine("Static method in interface");
}

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, methods can have default implementations in interfaces. interface ILogger

Example code

{ void Log(string message); void LogWarning(string message) => Console.WriteLine("Warning: " + message); }

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, a class can implement multiple interfaces, solving multiple inheritance issues. class FlyingCar : IDriveable, IFlyable

Example code

{
public void Drive() => Console.WriteLine("Driving");
public void Fly() => Console.WriteLine("Flying");
}

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: The implementing class must provide a single implementation for both interfaces. Or use explicit interface implementation to differentiate.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, explicit implementation allows a class to implement interface members separately. class Car : IDriveable

Example code

{
void IDriveable.Drive() => Console.WriteLine("Explicit drive");
}

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Expose method signatures without implementation. Users interact with the interface, not the underlying implementation.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Code depends on interface, not concrete class. Makes it easier to swap implementations without changing dependent code. void StartVehicle(IDriveable vehicle) { vehicle.Drive(); }

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: 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) { _vehicle = vehicle; } }

Example code

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) { _vehicle = vehicle; }
}

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, interfaces can inherit from other interfaces, forming a hierarchy. interface IFlyable { void Fly(); } interface IAdvancedFlyable : IFlyable { void Loop(); }

Example code

Yes, interfaces can inherit from other interfaces, forming a hierarchy. interface IFlyable { void Fly(); }
interface IAdvancedFlyable : IFlyable { void Loop(); }

Real-world example (ShopNest)

ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Interfaces with no methods or properties, used to mark classes for special behavior. Example: ISerializable marks classes as serializable.

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Use the abstract keyword. abstract class Vehicle {

Example code

public abstract void Start();
public void Stop() => Console.WriteLine("Vehicle stopped");
}

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, abstract classes can have fields, properties, and constants. abstract class Vehicle { protected string Brand; }

Example code

Yes, abstract classes can have fields, properties, and constants. abstract class Vehicle { protected string Brand; }

Real-world example (ShopNest)

Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details