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 351–375 of 519

Career & HR topics

By tech stack

Junior PDF
What is an abstract method?

Short answer: A method declared with abstract without implementation. Must be overridden in a derived class. abstract class Vehicle { Example code public abstract void Start(); } class Car : Vehicle { public override voi…

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…

Mid PDF
Can abstract classes implement interfaces?

Short answer: Yes, abstract classes can implement interfaces partially or fully. Derived classes must implement any remaining abstract members. interface IDriveable { void Drive(); } abstract class Vehicle : IDriveable {…

Mid PDF
Can abstract classes be sealed?

Short answer: No, abstract classes cannot be sealed. A sealed class cannot be inherited, while abstract classes are meant to be inherited. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay…

Mid PDF
Can an abstract class have private members?

Short answer: Yes, abstract classes can have private members, but derived classes cannot access them. Private members can be accessed via protected or public methods. Real-world example (ShopNest) ShopNest’s Order keeps…

Mid PDF
Can a class be both abstract and static?

Short answer: No, a class cannot be both abstract and static. Abstract classes are for inheritance, static classes cannot be inherited. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and…

Junior PDF
What is the difference between an abstract method and a virtual method?

Short answer: llow derived class to optionally override Real-world example (ShopNest) ShopNest has a base PaymentMethod with virtual decimal Fee() . UpiPayment and CardPayment override the fee logic without changing the…

Junior PDF
What is the difference between an abstract method and a virtual method?

Short answer: 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 Purp…

Mid PDF
Why use abstract classes over interfaces?

Short answer: Abstract classes can provide shared implementation, fields, and constructors. Useful when multiple classes share common behavior along with enforced abstraction. Real-world example (ShopNest) Checkout calls…

Mid PDF
Give an example of an abstract class implementation.?

Short answer: abstract class Employee { Example code public string Name { get; set; } public abstract void Work(); public void Report() => Console.WriteLine("Reporting work done"); } class Developer : Employ…

Junior PDF
What is the difference between an abstract class and a normal class?

Short answer: Feature Abstract Class Normal Class Instantiation Cannot instantiate Can instantiate Methods Can have abstract methods All methods must have implementation Purpose Serve as base for inheritance General purp…

Mid PDF
Can you override an abstract method as virtual?

Short answer: 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. abstract class Vehicle { public abstra…

Mid PDF
Can you inherit multiple abstract classes?

Short answer: 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 vo…

Junior PDF
What is the key difference between abstract classes and interfaces?

Short answer: Feature Abstract Class Interface Implementation Can have full/partial implementation Cannot have full implementation (except default methods in C# 8+) Fields Can have fields Cannot have fields Inheritance S…

Mid PDF
When would you choose an interface over an abstract class?

Short answer: When you want to define pure contracts without implementation. When you need multiple inheritance. When you want loose coupling for dependency injection. Real-world example (ShopNest) Checkout calls IPaymen…

Mid PDF
When should you prefer abstract class over an interface?

Short answer: When you want to share common code among related classes. When you need fields or constructors. When future changes may require adding non-breaking methods. Real-world example (ShopNest) Checkout calls IPay…

Mid PDF
Can you implement multiple interfaces?

Short answer: Can you inherit multiple abstract classes? Yes → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance) Real-world example (ShopNest) Checkout calls IPaymentGate…

Mid PDF
Can you implement multiple interfaces? Can you inherit multiple

Short answer: bstract classes? Yes → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance) Real-world example (ShopNest) ShopNest has a base PaymentMethod with virtual decima…

Mid PDF
Can you implement multiple interfaces?

Short answer: Yes → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance) Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and Stripe adapters…

Mid PDF
Which allows multiple inheritance — interface or abstract class?

Short answer: Interface allows multiple inheritance. Interface allows multiple inheritance. Real-world example (ShopNest) ShopNest has a base PaymentMethod with virtual decimal Fee() . UpiPayment and CardPayment override…

Mid PDF
Can interfaces contain implementation (default interface methods)?

Short answer: Yes, starting from C# 8, interfaces can have default method implementations. interface ILogger Example code { void Log(string message); void LogWarning(string message) => Console.WriteLine("Warning:…

Mid PDF
Can abstract classes provide full implementation?

Short answer: Yes, abstract classes can have fully implemented methods along with abstract methods. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and Stripe adapters implement the same…

Mid PDF
Can you have properties in both interfaces and abstract classes?

Short answer: Yes, both can define properties. Interface properties are abstract by default; abstract class properties can have implementation. interface ICar { int Speed { get; set; } } abstract class Vehicle { public i…

Mid PDF
Can you create an object of an interface?

Short answer: No, you cannot instantiate an interface. You can only use it as a reference type. ICar car = new Car(); // Interface reference // ICar c = new ICar(); // Not allowed Example code No, you cannot instantiate…

Mid PDF
Can you use abstract classes with dependency injection?

Short answer: Yes, abstract classes can be injected as service contracts, but interfaces are preferred for looser coupling. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay and Stripe adap…

C# OOP C# Programming Tutorial · OOP

Short answer: A method declared with abstract without implementation. Must be overridden in a derived class. abstract class Vehicle {

Example code

public abstract void Start();
}
class Car : Vehicle
{
public override void Start() => Console.WriteLine("Car started"); }

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

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, abstract classes can implement interfaces partially or fully. Derived classes must implement any remaining abstract members. interface IDriveable { void Drive(); } abstract class Vehicle : IDriveable { public abstract void Drive(); }

Example code

class Car : Vehicle { public override void Drive() => Console.WriteLine("Car drives"); }

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, abstract classes cannot be sealed. A sealed class cannot be inherited, while abstract classes are meant to be inherited.

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 private members, but derived classes cannot access them. Private members can be accessed via protected or public methods.

Real-world example (ShopNest)

ShopNest’s Order keeps _items private and exposes AddItem() so totals stay correct—callers cannot put a negative quantity directly into the list.

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, a class cannot be both abstract and static. Abstract classes are for inheritance, static classes cannot be inherited.

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: llow derived class to optionally override

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: 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

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: Abstract classes can provide shared implementation, fields, and constructors. Useful when multiple classes share common behavior along with enforced abstraction.

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 Employee {

Example code

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 application"); } // Usage Employee dev = new Developer() { Name = "Alice" }; dev.Work(); dev.Report();

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: Feature Abstract Class Normal Class Instantiation Cannot instantiate Can instantiate Methods Can have abstract methods All methods must have implementation Purpose Serve as base for inheritance General purpose use

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, 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. abstract class Vehicle { public abstract void Start(); } class Car : Vehicle { public override void Start() => Console.WriteLine("Car starts"); }

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 allow multiple class inheritance. Use interfaces as a workaround. interface IFlyable { void Fly(); } interface IDriveable { void Drive(); } class FlyingCar : IFlyable, IDriveable { public void Fly() {} public void Drive() {} } Q&A

Example code

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() {} public void Drive() {} } Q&A

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: Feature Abstract Class Interface Implementation Can have full/partial implementation Cannot have full implementation (except default methods in C# 8+) Fields Can have fields Cannot have fields Inheritance Single class inheritance Multiple interface inheritance allowed Constructors Allowed Not allowed Access Modifiers Can have public, protected, private Members are public by default

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: When you want to define pure contracts without implementation. When you need multiple inheritance. When you want loose coupling for dependency injection.

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: When you want to share common code among related classes. When you need fields or constructors. When future changes may require adding non-breaking methods.

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: Can you inherit multiple abstract classes? Yes → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance)

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: bstract classes? Yes → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance)

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 → Multiple interfaces No → Multiple abstract classes (C# does not support multiple class inheritance)

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: Interface allows multiple inheritance. Interface allows multiple inheritance.

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, starting from C# 8, interfaces can have default method implementations. 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, abstract classes can have fully implemented methods along with abstract methods.

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, both can define properties. Interface properties are abstract by default; abstract class properties can have implementation. interface ICar { int Speed { get; set; } } abstract class Vehicle { public int Speed { get; set; } }

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, you cannot instantiate an interface. You can only use it as a reference type. ICar car = new Car(); // Interface reference // ICar c = new ICar(); // Not allowed

Example code

No, you cannot instantiate an interface. You can only use it as a reference type. ICar car = new Car(); // Interface reference
// ICar c = new ICar(); // Not allowed

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 be injected as service contracts, but interfaces are preferred for looser coupling.

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