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 1676–1700 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Rigid Structure:?

Short answer: The pattern enforces a rigid structure for the algorithm, meaning that subclasses cannot change the overall order or flow of steps. If you need to adjust the structure of the algorithm, it may require chang…

GoF Patterns Read answer
Mid PDF
Common Algorithm Structure:?

Short answer: When you have a series of steps that must be followed in a specific order, but some of the steps need to be customized for different situations. For example, when creating frameworks for processes like data…

GoF Patterns Read answer
Mid PDF
Code Reusability:?

Short answer: The common structure of the algorithm is defined in the abstract class, so subclasses don't have to repeat the same steps. Only the details of specific steps need to be implemented in each subclass. Real-wo…

GoF Patterns Read answer
Mid PDF
Template Method (Cook):?

Short answer: The Cook method in the Recipe class defines the skeleton of the algorithm. It calls GatherIngredients, Prepare, CookMethod, and Serve in a fixed order. The first three steps are abstract and need to be impl…

GoF Patterns Read answer
Mid PDF
Abstract Class (Recipe):?

Short answer: The Recipe class defines the template method Cook, which contains the algorithm's skeleton. It delegates the implementation of specific steps (GatherIngredients, Prepare, and CookMethod) to subclasses by ma…

GoF Patterns Read answer
Mid PDF
Multiple Algorithms:?

Short answer: Use the Strategy Pattern when you have multiple algorithms for a specific task and want to switch between them easily (e.g., sorting, encryption, compression). Say this in the interview Define — one clear s…

GoF Patterns Read answer
Mid PDF
Flexibility and Reusability:?

Short answer: The strategy pattern allows algorithms to be swapped at runtime, making the code more flexible. You can add new sorting algorithms without changing the context class, thus adhering to the Open/Closed Princi…

GoF Patterns Read answer
Mid PDF
Strategy Interface:?

Short answer: The ISortStrategy interface allows any concrete sorting algorithm to be swapped in and out. The context (Sorter) doesn't need to know the specifics of the algorithm; it only knows that it can call the Sort…

GoF Patterns Read answer
Mid PDF
Strategy Interface (ISortStrategy):?

Short answer: The ISortStrategy interface defines a common method (Sort) that all concrete strategies must implement. This allows clients (in this case, the Sorter class) to work with any strategy that implements this in…

GoF Patterns Read answer
Mid PDF
Increased Number of Classes:?

Short answer: The State Pattern introduces a separate class for each state, which can lead to an increase in the number of classes in the system. For systems with many states, this can cause complexity. Real-world exampl…

GoF Patterns Read answer
Mid PDF
Finite State Machines (FSM):?

Short answer: When you have an object that can be in multiple predefined states and its behavior depends on the current state (e.g., traffic lights, order processing systems). Say this in the interview Define — one clear…

GoF Patterns Read answer
Mid PDF
State Interface:?

Short answer: The ITrafficLightState interface defines a method (Change) that allows the traffic light to transition between states (Red, Green, Yellow). Real-world example (ShopNest) Use a GoF pattern in ShopNest only w…

GoF Patterns Read answer
Mid PDF
State Interface (ITrafficLightState):?

Short answer: The ITrafficLightState interface defines a method (Change) that allows the state to transition to another state. The method accepts a TrafficLight object as a parameter to facilitate the state change. publi…

GoF Patterns Read answer
Mid PDF
Global State:?

Short answer: The Singleton can act as a global variable, which may make it harder to track state changes and can lead to issues with dependencies. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it…

GoF Patterns Read answer
Mid PDF
Thread-Safe Singleton (Eager Initialization):?

Short answer: The singleton instance is created when the class is loaded, guaranteeing thread safety without locking. However, it may have a slight performance overhead due to the instance being created regardless of whe…

GoF Patterns Read answer
Mid PDF
Configuration Management:?

Short answer: When there is a need to store and share global configuration settings across the application (e.g., database connection strings, file paths, API keys). Say this in the interview Define — one clear sentence…

GoF Patterns Read answer
Mid PDF
Controlled Access to a Single Instance:?

Short answer: The Singleton Pattern ensures that a class has only one instance, and it provides a global access point to that instance. This is especially useful when managing resources that should be shared across the a…

GoF Patterns Read answer
Mid PDF
Single Instance:?

Short answer: The Singleton class (ConfigurationManager) only allows one instance to be created. The instance is stored in the static _instance field, ensuring that only one object exists. Real-world example (ShopNest) U…

GoF Patterns Read answer
Mid PDF
Singleton Class (ConfigurationManager):?

Short answer: The ConfigurationManager class is designed to ensure that there is only one instance of it throughout the application. Explain a bit more The Instance property handles the lazy initialization of the singlet…

GoF Patterns Read answer
Mid PDF
Image/Video Loading:?

Short answer: A virtual proxy can be used to load large images or videos on-demand, especially when dealing with high-resolution media files that could be costly to load upfront. Real-world example (ShopNest) Use a GoF p…

GoF Patterns Read answer
Mid PDF
Virtual Proxy:?

Short answer: Used to delay the creation or initialization of an expensive object until it is actually needed, like the ProxyImage example above. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it r…

GoF Patterns Read answer
Mid PDF
Lazy Initialization:?

Short answer: The proxy allows you to delay the creation of resource-intensive objects (like loading an image) until it's actually needed, optimizing resource usage. Real-world example (ShopNest) Use a GoF pattern in Sho…

GoF Patterns Read answer
Mid PDF
Proxy Initialization:?

Short answer: The client interacts with the proxy (ProxyImage), which implements the same interface (IImage) as the real subject (RealImage). Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it remov…

GoF Patterns Read answer
Mid PDF
Subject Interface (IImage):?

Short answer: This is the common interface that both the real object (RealImage) and the proxy object (ProxyImage) implement. It defines the method Display() that both concrete classes must implement. public interface II…

GoF Patterns Read answer
Mid PDF
Game Development:?

Short answer: In a role-playing game (RPG), characters or enemies can be cloned from a prototype template (e.g., an "Archer" prototype) and customized with different attributes (e.g., health, attack power) to c…

GoF Patterns Read answer

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

Short answer: The pattern enforces a rigid structure for the algorithm, meaning that subclasses cannot change the overall order or flow of steps. If you need to adjust the structure of the algorithm, it may require changes to the base class.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: When you have a series of steps that must be followed in a specific order, but some of the steps need to be customized for different situations. For example, when creating frameworks for processes like data parsing, game initialization, or file handling.

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

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

Short answer: The common structure of the algorithm is defined in the abstract class, so subclasses don't have to repeat the same steps. Only the details of specific steps need to be implemented in each subclass.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The Cook method in the Recipe class defines the skeleton of the algorithm. It calls GatherIngredients, Prepare, CookMethod, and Serve in a fixed order. The first three steps are abstract and need to be implemented by subclasses, while the Serve method is concrete and always works the same way.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The Recipe class defines the template method Cook, which contains the algorithm's skeleton. It delegates the implementation of specific steps (GatherIngredients, Prepare, and CookMethod) to subclasses by making them abstract. The Serve method is concrete and always executes the same way for all recipes. public abstract class Recipe

Example code

{
public void Cook()
{ GatherIngredients(); Prepare(); CookMethod(); Serve(); } protected abstract void GatherIngredients(); protected abstract void Prepare(); protected abstract void CookMethod(); private void Serve() => Console.WriteLine("Serving the dish.");
}

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: Use the Strategy Pattern when you have multiple algorithms for a specific task and want to switch between them easily (e.g., sorting, encryption, compression).

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

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

Short answer: The strategy pattern allows algorithms to be swapped at runtime, making the code more flexible. You can add new sorting algorithms without changing the context class, thus adhering to the Open/Closed Principle (open for extension, closed for modification).

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The ISortStrategy interface allows any concrete sorting algorithm to be swapped in and out. The context (Sorter) doesn't need to know the specifics of the algorithm; it only knows that it can call the Sort method on any strategy that implements this interface.

Real-world example (ShopNest)

Discount rules are Strategy objects: PercentageOff, FlatOff, BuyOneGetOne—checkout picks one without a huge if/else.

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

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

Short answer: The ISortStrategy interface defines a common method (Sort) that all concrete strategies must implement. This allows clients (in this case, the Sorter class) to work with any strategy that implements this interface. public interface ISortStrategy

Example code

{ void Sort(List<int> list); }

Real-world example (ShopNest)

Discount rules are Strategy objects: PercentageOff, FlatOff, BuyOneGetOne—checkout picks one without a huge if/else.

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

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

Short answer: The State Pattern introduces a separate class for each state, which can lead to an increase in the number of classes in the system. For systems with many states, this can cause complexity.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: When you have an object that can be in multiple predefined states and its behavior depends on the current state (e.g., traffic lights, order processing systems).

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

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

Short answer: The ITrafficLightState interface defines a method (Change) that allows the traffic light to transition between states (Red, Green, Yellow).

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The ITrafficLightState interface defines a method (Change) that allows the state to transition to another state. The method accepts a TrafficLight object as a 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.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The Singleton can act as a global variable, which may make it harder to track state changes and can lead to issues with dependencies.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The singleton instance is created when the class is loaded, guaranteeing thread safety without locking. However, it may have a slight performance overhead due to the instance being created regardless of whether it is needed. public class Singleton

Example code

{
private static readonly Singleton _instance = new Singleton();
private Singleton() { }
public static Singleton Instance => _instance;
}

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: When there is a need to store and share global configuration settings across the application (e.g., database connection strings, file paths, API keys).

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

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

Short answer: The Singleton Pattern ensures that a class has only one instance, and it provides a global access point to that instance. This is especially useful when managing resources that should be shared across the application, such as configuration settings, logging, or database connections.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The Singleton class (ConfigurationManager) only allows one instance to be created. The instance is stored in the static _instance field, ensuring that only one object exists.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The ConfigurationManager class is designed to ensure that there is only one instance of it throughout the application.

Explain a bit more

The Instance property handles the lazy initialization of the singleton instance, ensuring that it's only created once and then reused.

Example code

{
private static ConfigurationManager _instance;
private static readonly object _lock = new object(); // Lock
for thread safety
private ConfigurationManager() { } // Private constructor to prevent instantiation public static ConfigurationManager Instance
{ get { lock (_lock) // Ensure thread safety {
return _instance ??= new ConfigurationManager(); // Lazy initialization }
}
}

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: A virtual proxy can be used to load large images or videos on-demand, especially when dealing with high-resolution media files that could be costly to load upfront.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: Used to delay the creation or initialization of an expensive object until it is actually needed, like the ProxyImage example above.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The proxy allows you to delay the creation of resource-intensive objects (like loading an image) until it's actually needed, optimizing resource usage.

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: The client interacts with the proxy (ProxyImage), which implements the same interface (IImage) as the real subject (RealImage).

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: This is the common interface that both the real object (RealImage) and the proxy object (ProxyImage) implement. It defines the method Display() that both concrete classes must implement. public interface IImage

Example code

{ void Display(); }

Real-world example (ShopNest)

Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solves in the interview.

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

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

Short answer: In a role-playing game (RPG), characters or enemies can be cloned from a prototype template (e.g., an "Archer" prototype) and customized with different attributes (e.g., health, attack power) to create new characters or enemies.

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