Interview Q&A

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

4616 total questions 4516 technical 100 career & HR 4346 from PDF library

Showing 1–24 of 24

Career & HR topics

By tech stack

Junior PDF
What is the Singleton pattern and why is it used?

The Singleton pattern ensures a class has only one instance and provides a global point of ccess to it. It’s commonly used when exactly one object is needed to coordinate actions cross the system, such as configuration s…

SOLID Read answer
Junior PDF
State Interface (ITrafficLightState): ● The ITrafficLightState interface defines a method (Change) that allows the state to transition to another state. The method accepts a TrafficLight object as

parameter to facilitate the state change. public interface ITrafficLightState { void Change(TrafficLight light); } Each concrete state class (Red, Green, Yellow) will implement this interface, defining the specific behav…

GoF Patterns Read answer
Junior PDF
Subject Interface (INewsPublisher): ● This interface defines methods for subscribing, unsubscribing, and notifying observers. The subject manages a list of observers and notifies them when there is

Answer: n update. public interface INewsPublisher { void Subscribe(IObserver observer); void Unsubscribe(IObserver observer); void Notify(string news); } What interviewers expect A clear definition tied to GoF Patterns i…

GoF Patterns Read answer
Junior PDF
Product Interface (ILogger): ○ This interface defines the common method Log that will be implemented by?

Answer: ll types of loggers (e.g., file, console). public interface ILogger { void Log(string message); } What interviewers expect A clear definition tied to GoF Patterns in Gang of Four Patterns projects Trade-offs (per…

GoF Patterns Read answer
Junior PDF
Component (ICoffee): ○ This is the base interface that defines the common methods for the Cost()?

Answer: nd Description() that every coffee component will implement. public interface ICoffee { double Cost(); string Description(); } What interviewers expect A clear definition tied to GoF Patterns in Gang of Four Patt…

GoF Patterns Read answer
Junior PDF
Steps Defined by Subclasses:?

Answer: Subclasses, like PastaRecipe, implement the GatherIngredients, Prepare, and CookMethod methods. These methods contain the specific details of the recipe, such as the ingredients, preparation steps, and cooking pr…

GoF Patterns Read answer
Junior PDF
Builder Interface (IPizzaBuilder): ○ The IPizzaBuilder interface defines the steps for constructing a pizza. It includes methods for setting the dough, sauce, and adding toppings, as well

Answer: s a Build() method to return the fully constructed pizza. public interface IPizzaBuilder { void SetDough(string dough); void SetSauce(string sauce); void AddTopping(string topping); Pizza Build(); } What intervie…

GoF Patterns Read answer
Junior PDF
What is the Factory pattern and when would you use it?

The Factory pattern is a creational design pattern that provides an interface for creating objects but allows subclasses or implementations to decide which class to instantiate. It’s used to encapsulate object creation,…

SOLID Read answer
Junior PDF
What is the Strategy pattern and what problem does it solve?

The Strategy pattern is a behavioral design pattern that defines a family of algorithms, encapsulates each one, and makes them interchangeable at runtime. It allows the algorithm to vary independently from clients that u…

SOLID Read answer
Junior PDF
What is the Repository pattern and why is it important in .NET

pplications? The Repository pattern abstracts the data access layer from the business logic by providing collection-like interface to access domain objects. It helps keep data access logic centralized and makes the codeb…

SOLID Read answer
Junior PDF
What is the Repository pattern and why is it important in .NET applications?

The Repository pattern abstracts the data access layer from the business logic by providing a collection-like interface to access domain objects. It helps keep data access logic centralized and makes the codebase easier…

SOLID Read answer
Junior PDF
What is the Unit of Work pattern?

The Unit of Work pattern is a design pattern used to maintain a list of operations to be performed within a single transaction. It ensures that all operations either succeed or fail together, providing consistency and ma…

SOLID Read answer
Junior PDF
What is Dependency Injection and why is it useful?

Dependency Injection (DI) is a design pattern that allows an object to receive its dependencies from an external source rather than creating them itself. This promotes loose coupling, enhances testability, and simplifies…

SOLID Read answer
Junior PDF
What is the difference between Scoped, Singleton, and Transient lifetimes?

Transient: A new instance is created every time it is requested. Scoped: A single instance is created per request/HTTP request. Singleton: A single instance is created and shared across the application lifetime. Lifetime…

SOLID Read answer
Junior PDF
What is the Single Responsibility Principle?

The Single Responsibility Principle (SRP) states that a class should have only one reason to change. In other words, it should have only one responsibility or job. Each class should do one thing, and do it well. For exam…

SOLID Read answer
Junior PDF
What is an example where OCP is violated?

Before (OCP Violation): public class DiscountCalculator { public decimal CalculateDiscount(string customerType) { if (customerType == "Regular") return 10; if (customerType == "Premium") return 20; if (customerType == "V…

SOLID Read answer
Junior PDF
What is Liskov Substitution Principle?

The Liskov Substitution Principle (LSP) states that: Subtypes must be substitutable for their base types without altering the correctness of the program. In other words, if class S is a subclass of class T, then objects…

SOLID Read answer
Junior PDF
What is an example of violating LSP in .NET code?

Example (Violation of LSP): public class Rectangle { public virtual int Width { get; set; } public virtual int Height { get; set; } public int Area() => Width * Height; } public class Square : Rectangle { public overr…

SOLID Read answer
Junior PDF
What is Interface Segregation Principle?

Answer: No client should be forced to implement methods it does not use. Break large interfaces into smaller, focused interfaces. What interviewers expect A clear definition tied to SOLID in Design Patterns & SOLID p…

SOLID Read answer
Junior PDF
What is Dependency Inversion Principle?

The Dependency Inversion Principle (DIP) states that: High-level modules should not depend on low-level modules. Both should depend on abstractions. bstractions should not depend on details. Details should depend on bstr…

SOLID Read answer
Junior PDF
What is the difference between Repository and DAO patterns?

DAO (Data Access Object) focuses on low-level database operations and CRUD, typically mapping tables to objects. Repository abstracts data access at the domain level, working with aggregates/entities and encapsulating bu…

SOLID Read answer
Junior PDF
What is the role of IServiceCollection and IServiceProvider in DI?

IServiceCollection: A container used during app startup to register services and their lifetimes (Scoped, Transient, Singleton). It acts as a service registry. IServiceProvider: The built container that resolves and prov…

SOLID Read answer
Junior PDF
What is the difference between Composition and Inheritance?

Inheritance creates an “is-a” relationship, where a subclass inherits behavior and properties from a parent class. It can lead to tight coupling and fragile hierarchies if overused. Composition creates a “has-a” relation…

SOLID Read answer
Junior PDF
What is the difference between Cohesion and Coupling?

Cohesion: Degree to which elements of a module belong together. High cohesion means focused, well-defined responsibilities. Coupling: Degree of interdependence between modules. Low coupling means modules are independent…

SOLID Read answer

Design Patterns & SOLID Design Patterns in C# · SOLID

The Singleton pattern ensures a class has only one instance and provides a global point of

ccess to it. It’s commonly used when exactly one object is needed to coordinate actions

cross the system, such as configuration settings, logging, or caching.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

parameter to facilitate the state change.

public interface ITrafficLightState
{

void Change(TrafficLight light);

}
  • Each concrete state class (Red, Green, Yellow) will implement this interface, defining

the specific behavior of the traffic light for that state.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

Answer: n update. public interface INewsPublisher { void Subscribe(IObserver observer); void Unsubscribe(IObserver observer); void Notify(string news); }

What interviewers expect

  • A clear definition tied to GoF Patterns in Gang of Four Patterns projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Gang of Four Patterns 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Gang of Four Patterns architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

Answer: ll types of loggers (e.g., file, console). public interface ILogger { void Log(string message); }

What interviewers expect

  • A clear definition tied to GoF Patterns in Gang of Four Patterns projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Gang of Four Patterns 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Gang of Four Patterns architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

Answer: nd Description() that every coffee component will implement. public interface ICoffee { double Cost(); string Description(); }

What interviewers expect

  • A clear definition tied to GoF Patterns in Gang of Four Patterns projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Gang of Four Patterns 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Gang of Four Patterns architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

Answer: Subclasses, like PastaRecipe, implement the GatherIngredients, Prepare, and CookMethod methods. These methods contain the specific details of the recipe, such as the ingredients, preparation steps, and cooking process.

What interviewers expect

  • A clear definition tied to GoF Patterns in Gang of Four Patterns projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Gang of Four Patterns 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Gang of Four Patterns architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Gang of Four Patterns Design Patterns in C# · GoF Patterns

Answer: s a Build() method to return the fully constructed pizza. public interface IPizzaBuilder { void SetDough(string dough); void SetSauce(string sauce); void AddTopping(string topping); Pizza Build(); }

What interviewers expect

  • A clear definition tied to GoF Patterns in Gang of Four Patterns projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Gang of Four Patterns 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Gang of Four Patterns architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Factory pattern is a creational design pattern that provides an interface for creating

objects but allows subclasses or implementations to decide which class to instantiate. It’s

used to encapsulate object creation, promoting loose coupling and flexibility when the exact

types of objects aren’t known until runtime.

Use case: When a class can’t anticipate the class of objects it needs to create, or when you

want to delegate responsibility for object creation to subclasses.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Strategy pattern is a behavioral design pattern that defines a family of algorithms,

encapsulates each one, and makes them interchangeable at runtime.

It allows the algorithm to vary independently from clients that use it.

Problem it solves:

voids large if-else or switch statements when selecting behavior and promotes

flexibility by decoupling the algorithm from the client using it.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

pplications?

The Repository pattern abstracts the data access layer from the business logic by providing

collection-like interface to access domain objects.

It helps keep data access logic centralized and makes the codebase easier to maintain,

test, and swap out data sources (e.g., switching from EF Core to Dapper or an API).

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Repository pattern abstracts the data access layer from the business logic by providing

a collection-like interface to access domain objects.

It helps keep data access logic centralized and makes the codebase easier to maintain,

test, and swap out data sources (e.g., switching from EF Core to Dapper or an API).

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Unit of Work pattern is a design pattern used to maintain a list of operations to be

performed within a single transaction. It ensures that all operations either succeed or fail

together, providing consistency and managing changes to multiple business objects during a

transaction. It coordinates the writing out of changes and resolves potential concurrency

issues.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Dependency Injection (DI) is a design pattern that allows an object to receive its

dependencies from an external source rather than creating them itself. This promotes loose

coupling, enhances testability, and simplifies code maintenance.

Benefits:

  • Improves modularity
  • Enables easier unit testing (via mock dependencies)
  • Promotes adherence to SOLID principles (especially the Dependency Inversion

Principle)

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

  • Transient: A new instance is created every time it is requested.
  • Scoped: A single instance is created per request/HTTP request.
  • Singleton: A single instance is created and shared across the application lifetime.

Lifetime Created Per Use Case

Transient Every injection Lightweight, stateless services

Scoped HTTP Request Web services handling per-request

data

Singleton App lifetime Logging, configuration, cache

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Single Responsibility Principle (SRP) states that a class should have only one

reason to change. In other words, it should have only one responsibility or job.

Each class should do one thing, and do it well.

For example, a class that handles user authentication should not also be responsible for

logging or sending emails.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Before (OCP Violation):

public class DiscountCalculator
{
public decimal CalculateDiscount(string customerType)
{
if (customerType == "Regular") return 10;
if (customerType == "Premium") return 20;
if (customerType == "VIP") return 30;
return 0;
}
}
If you need to support a new customer type, you must modify this method — violating OCP.

fter (OCP Compliant):

public interface IDiscountStrategy
{

decimal GetDiscount();

}
public class RegularCustomerDiscount : IDiscountStrategy
{
public decimal GetDiscount() => 10;
}
public class PremiumCustomerDiscount : IDiscountStrategy
{
public decimal GetDiscount() => 20;
}
public class VipCustomerDiscount : IDiscountStrategy
{
public decimal GetDiscount() => 30;
}

Now you can add new customer types without modifying existing code — just create a new

strategy.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Liskov Substitution Principle (LSP) states that:

Subtypes must be substitutable for their base types without altering the

correctness of the program.

In other words, if class S is a subclass of class T, then objects of type T should be

replaceable with objects of type S without breaking the application.

This ensures that inheritance models is-a relationships correctly.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Example (Violation of LSP):

public class Rectangle
{
public virtual int Width { get; set; }
public virtual int Height { get; set; }
public int Area() => Width * Height;
}
public class Square : Rectangle
{
public override int Width
{
set { base.Width = base.Height = value; }
}
public override int Height
{
set { base.Width = base.Height = value; }
}
}

Now if you substitute Rectangle with Square:

Rectangle rect = new Square();
rect.Width = 5;
rect.Height = 10;

Console.WriteLine(rect.Area()); // Outputs 100, but logically

expected 50

❌ The behavior is incorrect — this is a violation of LSP.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

Answer: No client should be forced to implement methods it does not use. Break large interfaces into smaller, focused interfaces.

What interviewers expect

  • A clear definition tied to SOLID in Design Patterns & SOLID projects
  • Trade-offs (performance, maintainability, security, cost)
  • When you would and would not use it in production

Real-world example

In a production Design Patterns & SOLID 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.

How to explain in the interview

  1. Define the concept in one or two sentences.
  2. Context — where it fits in Design Patterns & SOLID architecture.
  3. Example — a specific project, bug, or performance win.
  4. Trade-off — what you gain vs what you sacrifice.

Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

The Dependency Inversion Principle (DIP) states that:

High-level modules should not depend on low-level modules. Both should

depend on abstractions.

bstractions should not depend on details. Details should depend on

bstractions.

In other words:

  • High-level business logic shouldn't depend on concrete implementations.
  • Instead, both high- and low-level components should depend on interfaces or

bstract classes.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

DAO (Data Access Object) focuses on low-level database operations and CRUD, typically

mapping tables to objects.

Repository abstracts data access at the domain level, working with aggregates/entities and

encapsulating business logic. Repository often uses DAO internally but is more aligned with

domain-driven design.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

  • IServiceCollection: A container used during app startup to register services and

their lifetimes (Scoped, Transient, Singleton). It acts as a service registry.

  • IServiceProvider: The built container that resolves and provides instances of

registered services at runtime. It uses the registrations to create and inject

dependencies.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

  • Inheritance creates an “is-a” relationship, where a subclass inherits behavior and

properties from a parent class. It can lead to tight coupling and fragile hierarchies if

overused.

  • Composition creates a “has-a” relationship, where a class contains instances of

other classes and delegates behavior to them. It’s more flexible and promotes loose

coupling.

Permalink & share

Design Patterns & SOLID Design Patterns in C# · SOLID

  • Cohesion: Degree to which elements of a module belong together. High cohesion

means focused, well-defined responsibilities.

  • Coupling: Degree of interdependence between modules. Low coupling means

modules are independent and changes in one don’t affect others.

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