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 1201–1225 of 3281

Career & HR topics

By tech stack

Popular tracks

Mid PDF
Subsystem Classes (Amplifier, DVDPlayer):?

Short answer: These classes represent the components of the complex subsystem. They have specific functionalities but are complicated to interact with individually. Amplifier: public class Amplifier Example code { public…

GoF Patterns Read answer
Mid PDF
Additional Decorators:?

Short answer: You could introduce more decorators, such as WhippedCreamDecorator, ChocolateDecorator, or CaramelDecorator, for a richer coffee experience. Real-world example (ShopNest) Logging and caching decorators wrap…

GoF Patterns Read answer
Mid PDF
Coffee Shops:?

Short answer: The Decorator Pattern is ideal for situations like coffee shops, where customers can customize their coffee with various add-ons (milk, sugar, whipped cream, flavor syrups, etc.). Each add-on is a decorator…

GoF Patterns Read answer
Mid PDF
Component Interface (ICoffee):?

Short answer: ICoffee defines the basic methods that any coffee type must implement. This allows the decorators to work with any class that implements this interface, providing flexibility to decorate any coffee object.…

GoF Patterns Read answer
Mid PDF
Component (ICoffee):?

Short answer: This is the base interface that defines the common methods for the Cost() and Description() that every coffee component will implement. public interface ICoffee Example code { double Cost(); string Descript…

GoF Patterns Read answer
Mid PDF
Add Methods for Removing Components:?

Short answer: The Directory class currently only has an Add() method for adding components. It could be improved by adding a Remove() method to allow for the dynamic removal of files or subdirectories. Real-world example…

GoF Patterns Read answer
Mid PDF
File Systems:?

Short answer: The most common application of the Composite Pattern is in representing file systems. A file system is inherently hierarchical: directories contain files and subdirectories, and those subdirectories can con…

GoF Patterns Read answer
Mid PDF
Uniform Treatment of Individual and Composite Objects:?

Short answer: Both files and directories are treated the same, as they implement the IFileSystemComponent interface. This makes it easier to manage a mixed structure of individual and composite objects. Real-world exampl…

GoF Patterns Read answer
Mid PDF
Component Interface (IFileSystemComponent):?

Short answer: Both File and Directory implement the IFileSystemComponent interface, which defines the common method ShowInfo(). This allows us to treat both files and directories uniformly. Real-world example (ShopNest)…

GoF Patterns Read answer
Mid PDF
Component (IFileSystemComponent):?

Short answer: This is the base interface that defines a common method ShowInfo() that will be implemented by both leaf and composite components. public interface IFileSystemComponent Example code { void ShowInfo(); } Rea…

GoF Patterns Read answer
Mid PDF
Redo Functionality:?

Short answer: You can extend the system by adding redo functionality. After an undo operation, you could store the undone command in a separate stack and allow users to redo the previous undo operation. Real-world exampl…

GoF Patterns Read answer
Mid PDF
Decoupling of Sender and Receiver:?

Short answer: The sender (the TextEditor) is decoupled from the receiver (Document). The TextEditor only knows how to invoke commands but does not need to understand the details of the operations (e.g., how the text is a…

GoF Patterns Read answer
Mid PDF
Encapsulation of Requests:?

Short answer: The command (in this case, AddTextCommand) encapsulates the request to add text to the document as an object. This allows for parameterization of the command with different requests (e.g., adding different…

GoF Patterns Read answer
Mid PDF
Command Interface (ICommand):?

Short answer: The ICommand interface defines two methods: ■ Execute(): Executes the command. ■ Undo(): Reverts the command if the user wishes to undo the action. public interface ICommand Example code { void Execute(); v…

GoF Patterns Read answer
Mid PDF
Decoupling of Request Handlers:?

Short answer: The Chain of Responsibility allows handlers to be decoupled from the client code. The client doesn’t need to know which handler will process the request, only that the request will eventually be processed b…

GoF Patterns Read answer
Mid PDF
Chain Setup:?

Short answer: In the Program class, we set up a chain of responsibility by calling SetNext() on the infoLogger and passing it the errorLogger. This ensures that the InfoLogger will process log messages with the Info leve…

GoF Patterns Read answer
Mid PDF
Handler Interface (Logger):?

Short answer: The Logger class is the handler interface that defines the contract for handling log messages. It includes a reference to the next logger in the chain (NextLogger) and a method (LogMessage) to process a mes…

GoF Patterns Read answer
Mid PDF
Separation of Construction and Representation:?

Short answer: The Builder Pattern separates the construction of a complex object from its representation. You can change the construction process without changing the way the object is represented or structured. Real-wor…

GoF Patterns Read answer
Mid PDF
Product (Pizza):?

Short answer: The Pizza class is the Product that we are constructing. It has properties for Dough, Sauce, and a list of Toppings. The ToString() method is overridden to provide a string representation of the pizza. publ…

GoF Patterns Read answer
Mid PDF
Decouples Abstraction and Implementation:?

Short answer: The Bridge pattern allows you to modify the abstraction (shapes) and the implementation (drawing API) independently, providing a cleaner and more modular design. Real-world example (ShopNest) Use a GoF patt…

GoF Patterns Read answer
Mid PDF
Abstraction:?

Short answer: The Shape class is the abstraction. It holds a reference to the IDrawingAPI and delegates the drawing task to it. It defines the common interface Draw() that all shapes must implement. Example code public a…

GoF Patterns Read answer
Mid PDF
Interface Compatibility:?

Short answer: The Adapter pattern allows you to integrate existing systems or third-party libraries without modifying their code. It enables compatibility between incompatible interfaces. Real-world example (ShopNest) Us…

GoF Patterns Read answer
Mid PDF
Target Interface:?

Short answer: The ITarget interface defines the expected interface that the client will use. It has a method Request() that the client expects to call. public interface ITarget Example code { void Request(); } Real-world…

GoF Patterns Read answer
Mid PDF
Separation of Concerns:?

Short answer: The pattern separates the UI creation logic from the client application. The application does not need to know about the specific UI components; it simply relies on the factory to provide them. Real-world e…

GoF Patterns Read answer
Mid PDF
Abstract Factory Interface:?

Short answer: The IUIFactory interface defines methods for creating abstract product types like buttons and checkboxes. This ensures that every concrete factory will implement the same methods, but each will provide plat…

GoF Patterns Read answer

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

Short answer: These classes represent the components of the complex subsystem. They have specific functionalities but are complicated to interact with individually. Amplifier: public class Amplifier

Example code

{
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}."); }

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: You could introduce more decorators, such as WhippedCreamDecorator, ChocolateDecorator, or CaramelDecorator, for a richer coffee experience.

Real-world example (ShopNest)

Logging and caching decorators wrap IProductRepository so core SQL code stays clean.

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 Decorator Pattern is ideal for situations like coffee shops, where customers can customize their coffee with various add-ons (milk, sugar, whipped cream, flavor syrups, etc.). Each add-on is a decorator that adds a cost and modifies the description of the order without modifying the core coffee object.

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: ICoffee defines the basic methods that any coffee type must implement. This allows the decorators to work with any class that implements this interface, providing flexibility to decorate any coffee object.

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 base interface that defines the common methods for the Cost() and Description() that every coffee component will implement. public interface ICoffee

Example code

{
double Cost();
string Description();
}

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 Directory class currently only has an Add() method for adding components. It could be improved by adding a Remove() method to allow for the dynamic removal of files or subdirectories.

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 most common application of the Composite Pattern is in representing file systems. A file system is inherently hierarchical: directories contain files 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: Both files and directories are treated the same, as they implement the IFileSystemComponent interface. This makes it easier to manage a mixed structure of individual and composite objects.

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: Both File and Directory implement the IFileSystemComponent interface, which defines the common method ShowInfo(). This allows us to treat both files and directories uniformly.

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 base interface that defines a common method ShowInfo() that will be implemented by both leaf and composite components. public interface IFileSystemComponent

Example code

{ void ShowInfo(); }

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: You can extend the system by adding redo functionality. After an undo operation, you could store the undone command in a separate stack and allow 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: The sender (the TextEditor) is decoupled from the receiver (Document). The TextEditor only knows how to invoke commands but does not need to understand the details of the operations (e.g., how the text is added or removed).

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 command (in this case, AddTextCommand) encapsulates the request to add 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).

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 ICommand interface defines two methods: ■ Execute(): Executes the command. ■ Undo(): Reverts the command if the user wishes to undo the action. public interface ICommand

Example code

{ void Execute(); void Undo(); }

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 Chain of Responsibility allows handlers to be decoupled from the client code. The client doesn’t need to know which handler will process the request, only that the request will eventually be processed by some handler in the chain.

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 the Program class, we set up a chain of responsibility by calling SetNext() on the infoLogger and passing it the errorLogger. This ensures that the InfoLogger will process log messages with the Info level, while the ErrorLogger will handle Error level messages.

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 Logger class is the handler interface that defines the contract for handling log messages. It includes a reference to the next logger in the chain (NextLogger) and a method (LogMessage) to process a message. If the current handler cannot handle the message, it passes the request along to the next handler in the chain. public abstract class Logger

Example code

{ protected Logger NextLogger; public void SetNext(Logger nextLogger) => NextLogger = nextLogger; public void LogMessage(string message, LogLevel level)
{
if (CanHandle(level))
{ Handle(message); } else { NextLogger?.LogMessage(message, level); }
} protected abstract bool CanHandle(LogLevel level); protected abstract void Handle(string message); }

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 Builder Pattern separates the construction of a complex object from its representation. You can change the construction process without changing the way the object is represented or structured.

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 Pizza class is the Product that we are constructing. It has properties for Dough, Sauce, and a list of Toppings. The ToString() method is overridden to provide a string representation of the pizza. public class Pizza

Example code

{
public string Dough { get; set; }
public string Sauce { get; set; }
public List<string> Toppings { get; } = new List<string>();
public override string ToString() => $"Pizza with {Dough} dough, {Sauce} sauce and toppings: {string.Join(", ", Toppings)}"; }

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 Bridge pattern allows you to modify the abstraction (shapes) and the implementation (drawing API) independently, providing a cleaner and more modular design.

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 Shape class is the abstraction. It holds a reference to the IDrawingAPI and delegates the drawing task to it. It defines the common interface Draw() that all shapes must implement.

Example code

public abstract class Shape
{ protected IDrawingAPI _drawingAPI; protected Shape(IDrawingAPI drawingAPI) => _drawingAPI = drawingAPI; public abstract void Draw();
}

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 Adapter pattern allows you to integrate existing systems or third-party libraries without modifying their code. It enables compatibility between incompatible interfaces.

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 ITarget interface defines the expected interface that the client will use. It has a method Request() that the client expects to call. public interface ITarget

Example code

{ void Request(); }

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 separates the UI creation logic from the client application. The application does not need to know about the specific UI components; it simply relies on the factory to provide them.

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 IUIFactory interface defines methods for creating abstract product types like buttons and checkboxes. This ensures that every concrete factory will implement the same methods, but each will provide platform-specific products. public interface IUIFactory

Example code

{ IButton CreateButton(); ICheckbox CreateCheckbox(); }

Real-world example (ShopNest)

ShopNest’s NotificationFactory creates Email or SMS senders based on user preference.

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