Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
dditional functionality like removing items during iteration. What interviewers expect A clear definition tied to GoF Patterns in Gang of Four Patterns projects Trade-offs (performance, maintainability, security, cost) W…
Answer: nd subject to change. By defining expressions as objects, it’s easy to extend or modify the grammar without affecting other parts of the system. What interviewers expect A clear definition tied to GoF Patterns in…
Answer: single button or command (like WatchMovie()), where the user only needs to press one button to turn everything on. What interviewers expect A clear definition tied to GoF Patterns in Gang of Four Patterns project…
mplifier: public class Amplifier { public void On() => Console.WriteLine("Amplifier is on."); public void Off() => Console.WriteLine("Amplifier is off."); } DVDPlayer: public class DVDPlayer { public void Play(stri…
Answer: nd subdirectories, and those subdirectories can contain further files or subdirectories. The Composite Pattern allows for easy traversal and management of this hierarchical structure. What interviewers expect A c…
llow users to redo the previous undo operation. 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…
Answer: dd text to the document as an object. This allows for parameterization of the command with different requests (e.g., adding different text) while decoupling the sender (the TextEditor) from the receiver (Document…
Answer: pplication does not need to know about the specific UI components; it simply relies on the factory to provide them. What interviewers expect A clear definition tied to GoF Patterns in Gang of Four Patterns projec…
Answer: While adding new operations is easy, adding new element types can be challenging. Every new element requires modifying all existing visitor classes to implement the new Visit method. What interviewers expect A cl…
Answer: The elements in the object structure (Book, Fruit) implement the Accept method, which is designed to accept a visitor. This method typically calls the appropriate visit method (Visit(Book book) or Visit(Fruit fru…
The IShoppingCartVisitor interface defines the operations that can be performed on the IShoppingCartElement objects. In this case, the visitor defines Visit(Book book) and Visit(Fruit fruit) methods for different product…
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…
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…
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. What intervie…
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 sub…
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 abst…
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). What interviewers expect A clear definition tied to…
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…
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…
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. publi…
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. What interviewers expec…
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). What interviewers expect A clear definition tied t…
Answer: The ITrafficLightState interface defines a method (Change) that allows the traffic light to transition between states (Red, Green, Yellow). What interviewers expect A clear definition tied to GoF Patterns in Gang…
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 IT…
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. What interviewers expect A clear definition tied to GoF Patterns in Gang of Fo…
Gang of Four Patterns Design Patterns in C# · GoF Patterns
dditional functionality like removing items during iteration.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: nd subject to change. By defining expressions as objects, it’s easy to extend or modify the grammar without affecting other parts of the system.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: single button or command (like WatchMovie()), where the user only needs to press one button to turn everything on.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
mplifier:
public class Amplifier
{
public void On() => Console.WriteLine("Amplifier is on.");
public void Off() => Console.WriteLine("Amplifier is off.");
}
DVDPlayer:
public class DVDPlayer
{
public void Play(string movie) => Console.WriteLine($"Playing
{movie}.");
}Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: nd subdirectories, and those subdirectories can contain further files or subdirectories. The Composite Pattern allows for easy traversal and management of this hierarchical structure.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
llow users to redo the previous undo operation.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: dd text to the document as an object. This allows for parameterization of the command with different requests (e.g., adding different text) while decoupling the sender (the TextEditor) from the receiver (Document).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: pplication does not need to know about the specific UI components; it simply relies on the factory to provide them.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: While adding new operations is easy, adding new element types can be challenging. Every new element requires modifying all existing visitor classes to implement the new Visit method.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: The elements in the object structure (Book, Fruit) implement the Accept method, which is designed to accept a visitor. This method typically calls the appropriate visit method (Visit(Book book) or Visit(Fruit fruit)) on the visitor.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
performed on the IShoppingCartElement objects. In this case, the visitor defines
Visit(Book book) and Visit(Fruit fruit) methods for different product
types.
public interface IShoppingCartVisitor
{
void Visit(Book book);
void Visit(Fruit fruit);
}Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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
{
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.");
}Gang of Four Patterns Design Patterns in C# · GoF Patterns
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).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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).
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
strategies must implement. This allows clients (in this case, the Sorter class) to
work with any strategy that implements this interface.
public interface ISortStrategy
{
void Sort(List<int> list);
}Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
Answer: The ITrafficLightState interface defines a method (Change) that allows the traffic light to transition between states (Red, Green, Yellow).
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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);
the specific behavior of the traffic light for that state.
Gang of Four Patterns Design Patterns in C# · GoF Patterns
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.
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.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.