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 151–157 of 157

Popular tracks

Senior PDF
Can interfaces help in event-driven architectures?

Short answer: Yes, interfaces can define event contracts for publishers/subscribers. Enables decoupling of event producers and consumers. Real-world example (ShopNest) Checkout calls IPaymentGateway.Charge() . Razorpay a…

Junior PDF
What is duck typing and does C# support it with interfaces?

Short answer: Duck typing: "If it looks like a duck and quacks like a duck, it is a duck." Behavior is based on method/property availability, not type inheritance. C# does not support full dynamic duck typing,…

Mid PDF
Can interfaces have private methods (C# 8+)?

Short answer: If so, why? Yes, C# 8 introduced private methods in interfaces. Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) =&g…

Mid PDF
Can interfaces have private methods (C# 8+)? If so, why?

Short answer: Yes, C# 8 introduced private methods in interfaces. Explain a bit more Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string messa…

Junior PDF
What is interface default implementation and why was it introduced?

Short answer: Allows interfaces to provide default method implementations. Reason: Enables adding new methods to interfaces without breaking existing implementations. interface IPrinter Example code { void Print(string m…

Mid PDF
How do abstract classes relate to abstract factories or strategy patterns?

Short answer: Abstract classes often define base contracts or template methods for patterns: Abstract Factory: Defines abstract methods to create families of objects. Strategy Pattern: Abstract class defines a common int…

Mid PDF
How does OOP enable microservice isolation and autonomy?

Short answer: Encapsulation and abstraction hide implementation details, exposing only necessary interfaces. Polymorphism allows replaceable modules, facilitating microservices independently deployed and evolved. SOLID p…

C# OOP C# Programming Tutorial · OOP

Short answer: Yes, interfaces can define event contracts for publishers/subscribers. Enables decoupling of event producers and consumers.

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: Duck typing: "If it looks like a duck and quacks like a duck, it is a duck." Behavior is based on method/property availability, not type inheritance. C# does not support full dynamic duck typing, but interfaces enable a similar concept by relying on contract-based behavior. Dynamic types in C# (dynamic) can also simulate duck typing. interface IFlyable { void Fly(); }

Example code

void MakeItFly(IFlyable obj) => obj.Fly(); // Any object implementing IFlyable works

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: If so, why? Yes, C# 8 introduced private methods in interfaces. Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) => LogInternal(message); private void LogInternal(string msg) => Console.WriteLine(msg); }

Example code

If so, why? Yes, C# 8 introduced private methods in interfaces. Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger
{
void Log(string message) => LogInternal(message);
private void LogInternal(string msg) => Console.WriteLine(msg);
}

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: Yes, C# 8 introduced private methods in interfaces.

Explain a bit more

Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) => LogInternal(message); private void LogInternal(string msg) => Console.WriteLine(msg); } Yes, C# 8 introduced private methods in interfaces. Purpose: share implementation among default interface methods without exposing them publicly. interface ILogger { void Log(string message) => LogInternal(message); private void LogInternal(string msg) => Console.WriteLine(msg);

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: Allows interfaces to provide default method implementations. Reason: Enables adding new methods to interfaces without breaking existing implementations. interface IPrinter

Example code

{ void Print(string msg); void PrintInfo(string msg) => Console.WriteLine("Info: " + msg); // 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: Abstract classes often define base contracts or template methods for patterns: Abstract Factory: Defines abstract methods to create families of objects. Strategy Pattern: Abstract class defines a common interface for interchangeable algorithms. abstract class PaymentStrategy {

Example code

public abstract void Pay(decimal amount);
}
class CreditCardPayment : PaymentStrategy
{
public override void Pay(decimal amount) => Console.WriteLine($"Paid {amount} by credit card"); }

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: Encapsulation and abstraction hide implementation details, exposing only necessary interfaces. Polymorphism allows replaceable modules, facilitating microservices independently deployed and evolved. SOLID principles and interface-based contracts promote loose coupling and autonomous service design.

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