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 1126–1150 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
When you have a complex object structure (element classes) and need to

Short answer: perform operations on them that vary. For example, in cases where you have a set of classes that are part of a complex hierarchy (like a shopping cart with various types of products), and you need to add ne…

GoF Patterns Read answer
Mid PDF
Element Interface (Accept method): ○ The elements in the object structure (Book, Fruit) implement the Accept method, which is designed to accept a visitor. This method typically calls the

Short answer: ppropriate visit method (Visit(Book book) or Visit(Fruit fruit)) on the visitor. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain…

GoF Patterns Read answer
Mid PDF
Rigid Structure: ○ 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

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

GoF Patterns Read answer
Mid PDF
Game Development: ○ 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

Short answer: ttributes (e.g., health, attack power) to create new characters or enemies. Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a project like ShopNest or…

GoF Patterns Read answer
Mid PDF
Deep vs. Shallow Cloning: ○ The example above demonstrates shallow cloning, where only the primitive properties are copied. If the object contains references to other objects (e.g.,

Short answer: rrays, lists), you may need to implement deep cloning to ensure that referenced objects are also cloned, not just referenced. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes…

GoF Patterns Read answer
Mid PDF
Text Editor (Undo/Redo Functionality): ○ In a text editor (such as Microsoft Word or Notepad), users can press Ctrl + Z to undo the most recent changes. Each time the user types, the editor saves

Short answer: snapshot of the text as a Memento. Pressing Ctrl + Z restores the text to its previous state. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes duplication or makes a change s…

GoF Patterns Read answer
Mid PDF
Loose Coupling: ○ The Mediator Pattern decouples objects from each other by centralizing communication through the mediator. Users don't need to know about each other and only communicate via the mediator. This reduces dependencies

Short answer: And makes the system easier to maintain. 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.…

GoF Patterns Read answer
Mid PDF
Mediator (ChatMediator): ○ The mediator manages communication between the users. It maintains a list of all users and broadcasts messages to all other users when one user sends

Short answer: message. This keeps the users from directly knowing about each other, thus promoting loose coupling. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes duplication or makes a c…

GoF Patterns Read answer
Mid PDF
Reverse Iteration: ○ The Iterator Pattern can be extended to support reverse iteration or provide?

Short answer: dditional functionality like removing items during iteration. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes duplication or makes a change safer—explain the problem it solv…

GoF Patterns Read answer
Mid PDF
Flexible Grammar Definition: ○ The Interpreter Pattern is ideal for scenarios where the grammar is complex?

Short answer: And subject to change. By defining expressions as objects, it’s easy to extend or modify the grammar without affecting other parts of the system. Real-world example (ShopNest) Use a GoF pattern in ShopNest…

GoF Patterns Read answer
Mid PDF
Home Theater Systems: ○ In real-life home theaters, turning on multiple devices like an amplifier, DVD player, and projector can be tedious. A Facade Pattern can simplify this into

Short answer: single button or command (like WatchMovie()), where the user only needs to press one button to turn everything on. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes duplicatio…

GoF Patterns Read answer
Mid PDF
Subsystem Classes (Amplifier, DVDPlayer): ○ These classes represent the components of the complex subsystem. They have specific functionalities but are complicated to interact with individually.

Short answer: mplifier: public class Amplifier { public void On() => Console.WriteLine("Amplifier is on."); public void Off() => Console.WriteLine("Amplifier is off."); } DVDPlayer: public class…

GoF Patterns Read answer
Mid PDF
File Systems: ○ The most common application of the Composite Pattern is in representing file systems. A file system is inherently hierarchical: directories contain files

Short answer: And subdirectories, and those subdirectories can contain further files or subdirectories. The Composite Pattern allows for easy traversal and management of this hierarchical structure. Real-world example (S…

GoF Patterns Read answer
Mid PDF
Redo Functionality: ○ You can extend the system by adding redo functionality. After an undo operation, you could store the undone command in a separate stack and

Short answer: llow users to redo the previous undo operation. 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 inte…

GoF Patterns Read answer
Mid PDF
Difficult to Add New Element Types:?

Short 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. Real-world example (Sho…

GoF Patterns Read answer
Mid PDF
Element Interface (Accept method):?

Short 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(Fru…

GoF Patterns Read answer
Mid PDF
Visitor Interface (IShoppingCartVisitor):?

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

GoF Patterns Read answer
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

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

Short answer: perform operations on them that vary. For example, in cases where you have a set of classes that are part of a complex hierarchy (like a shopping cart with various types of products), and you need to add new behaviors without changing the objects themselves.

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: ppropriate visit method (Visit(Book book) or Visit(Fruit fruit)) on the visitor.

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: djust 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: ttributes (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

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

Short answer: rrays, lists), you may need to implement deep cloning to ensure that referenced objects are also cloned, not just referenced.

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: snapshot of the text as a Memento. Pressing Ctrl + Z restores the text to its previous 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: And makes the system easier to maintain.

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: message. This keeps the users from directly knowing about each other, thus promoting loose coupling.

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: dditional functionality like removing items during iteration.

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: And subject to change. By defining expressions as objects, it’s easy to extend or modify the grammar without affecting other parts of the system.

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: single button or command (like WatchMovie()), where the user only needs to press one button to turn everything on.

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: 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}."); } mplifier: public class Amplifier { public void On() => Console.WriteLine("Amplifier is… public void Off() => Console.WriteLine("Amplifier is off."); }…

Example code

{
public void Play(string movie) => Console.WriteLine($"Playing {movie}."); }

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: And subdirectories, and those subdirectories can contain further files or subdirectories. The Composite Pattern allows for easy traversal and management of this hierarchical structure.

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: llow users to redo the previous undo operation.

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

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

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 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 types. public interface IShoppingCartVisitor

Example code

{ void Visit(Book book); void Visit(Fruit fruit); }

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