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 101–125 of 433

Career & HR topics

By tech stack

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
Mid PDF
Deep vs. Shallow Cloning:?

Short answer: The example above demonstrates shallow cloning, where only the primitive properties are copied. If the object contains references to other objects (e.g., arrays, lists), you may need to implement deep cloni…

GoF Patterns Read answer
Mid PDF
Efficient Object Creation:?

Short answer: Cloning objects is often more efficient than creating new ones from scratch, especially when the object is complex or expensive to create. This can be particularly useful in performance-sensitive applicatio…

GoF Patterns Read answer
Mid PDF
Prototype Interface (ICloneable):?

Short answer: This interface defines the Clone() method that concrete prototypes must implement. This method returns a new object that is a copy of the current object. public interface ICloneable Example code { ICloneabl…

GoF Patterns Read answer
Mid PDF
News Feeds (as shown above):?

Short answer: A news website where multiple users subscribe to receive notifications when new articles or breaking news are published. Real-world example (ShopNest) Use a GoF pattern in ShopNest only when it removes dupl…

GoF Patterns Read answer
Mid PDF
Performance Overhead:?

Short answer: If there are a large number of observers or if the state changes frequently, the Observer Pattern can lead to performance overhead due to the frequent notifications sent to all observers. Real-world example…

GoF Patterns Read answer
Mid PDF
Subject (NewsPublisher):?

Short answer: The NewsPublisher class acts as the subject in the Observer Pattern. It maintains a list of IObserver instances (subscribers) and provides methods to add (Subscribe), remove (Unsubscribe), and notify them (…

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

Short answer: This interface defines methods for subscribing, unsubscribing, and notifying observers. The subject manages a list of observers and notifies them when there is an update. public interface INewsPublisher Exa…

GoF Patterns Read answer
Mid PDF
Text Editor (Undo/Redo Functionality):?

Short answer: 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 a snapshot of the text as a Memento. Pressing Ctrl…

GoF Patterns Read answer
Mid PDF
Memory Consumption:?

Short answer: If the object’s state is large or changes frequently, the Memento Pattern can result in significant memory usage, as you need to store many copies of the state (each memento). Real-world example (ShopNest)…

GoF Patterns Read answer
Mid PDF
Encapsulation Preservation:?

Short answer: The Memento Pattern preserves encapsulation because the state is stored in the Memento object, and the TextEditor is not exposed to direct manipulation of its internal state. The only way to change or acces…

GoF Patterns Read answer
Mid PDF
TextEditor (Originator):?

Short answer: The TextEditor is the originator of the state. It holds the text that changes over time and can save and restore its state using mementos. Real-world example (ShopNest) Use a GoF pattern in ShopNest only wh…

GoF Patterns Read answer
Mid PDF
Chat Application:?

Short answer: A classic example of the Mediator Pattern is a chat application, where the mediator is responsible for sending messages between users. It ensures that messages are routed correctly without the users needing…

GoF Patterns Read answer
Mid PDF
Loose Coupling:?

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

GoF Patterns Read answer
Mid PDF
Mediator (ChatMediator):?

Short answer: 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 a message. This keeps the users from directly knowing ab…

GoF Patterns Read answer
Mid PDF
Mediator Interface (IChatMediator):?

Short answer: The IChatMediator interface defines two key operations: ■ SendMessage(string message, User user): Sends a message from a user to all other registered users. ■ RegisterUser(User user): Registers users with t…

GoF Patterns Read answer
Mid PDF
Reverse Iteration:?

Short answer: The Iterator Pattern can be extended to support reverse iteration or provide additional functionality like removing items during iteration. Real-world example (ShopNest) Use a GoF pattern in ShopNest only w…

GoF Patterns Read answer
Mid PDF
Iterating Over a List of Products:?

Short answer: The Iterator Pattern is commonly used when working with product lists, customer lists, or any other collection where you need to iterate over items sequentially. For instance, in an e-commerce application,…

GoF Patterns Read answer

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

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

Short answer: The example above demonstrates shallow cloning, where only the primitive properties are copied. If the object contains references to other objects (e.g., arrays, lists), you may need to implement deep cloning to ensure that referenced objects are also cloned, not just referenced.

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: Cloning objects is often more efficient than creating new ones from scratch, especially when the object is complex or expensive to create. This can be particularly useful in performance-sensitive applications like games or simulations.

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 interface defines the Clone() method that concrete prototypes must implement. This method returns a new object that is a copy of the current object. public interface ICloneable

Example code

{ ICloneable Clone(); }

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 news website where multiple users subscribe to receive notifications when new articles or breaking news are published.

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: If there are a large number of observers or if the state changes frequently, the Observer Pattern can lead to performance overhead due to the frequent notifications sent to all observers.

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 NewsPublisher class acts as the subject in the Observer Pattern. It maintains a list of IObserver instances (subscribers) and provides methods to add (Subscribe), remove (Unsubscribe), and notify them (Notify).

Real-world example (ShopNest)

When order status changes, observers update email, SMS, and analytics without the Order class knowing each one.

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 interface defines methods for subscribing, unsubscribing, and notifying observers. The subject manages a list of observers and notifies them when there is an update. public interface INewsPublisher

Example code

{ void Subscribe(IObserver observer); void Unsubscribe(IObserver observer); void Notify(string news); }

Real-world example (ShopNest)

When order status changes, observers update email, SMS, and analytics without the Order class knowing each one.

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 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 a 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: If the object’s state is large or changes frequently, the Memento Pattern can result in significant memory usage, as you need to store many copies of the state (each memento).

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 Memento Pattern preserves encapsulation because the state is stored in the Memento object, and the TextEditor is not exposed to direct manipulation of its internal state. The only way to change or access the state is through well-defined methods (Save and Restore).

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 TextEditor is the originator of the state. It holds the text that changes over time and can save and restore its state using mementos.

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 classic example of the Mediator Pattern is a chat application, where the mediator is responsible for sending messages between users. It ensures that messages are routed correctly without the users needing to know about each other.

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 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 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: 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 a 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: The IChatMediator interface defines two key operations: ■ SendMessage(string message, User user): Sends a message from a user to all other registered users. ■ RegisterUser(User user): Registers users with the mediator so they can send and receive messages. public interface IChatMediator

Example code

{ void SendMessage(string message, User user); void RegisterUser(User user); }

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 Iterator Pattern can be extended to support reverse iteration or provide additional 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: The Iterator Pattern is commonly used when working with product lists, customer lists, or any other collection where you need to iterate over items sequentially. For instance, in an e-commerce application, you might use an iterator to list products, iterate through available categories, or paginate results.

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