SOLID & Design Patterns Interview

Structural, Creational & Behavioral Patterns

Questions 26-50: Structural, Creational & Behavioral Patterns.

25 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

25 Results
26
JuniorBeginner

What is the Adapter Pattern?

The Adapter Pattern converts the interface of an existing class into an interface that a client expects. It is useful when an application must integrate a legacy component, third-party library, or external service whose API does not match the application's abstraction.

27
JuniorBeginner

What is the Facade Pattern?

The Facade Pattern provides a simplified interface over a more complex subsystem. Instead of requiring callers to coordinate several lower-level services, the facade exposes a smaller set of operations that represent common use cases.

28
JuniorBeginner

What is the Proxy Pattern?

The Proxy Pattern provides a stand-in object that controls access to another object while exposing a compatible interface. The proxy can add behavior such as lazy loading, authorization, remote access, caching, or logging.

29
JuniorBeginner

What is the difference between Adapter, Facade, and Proxy?

Adapter changes an interface so an incompatible component can be used by a client. Facade simplifies access to a complex subsystem by presenting a higher-level interface. Proxy controls access to another object while generally preserving its expected interface.

30
JuniorBeginner

What is the Builder Pattern?

The Builder Pattern separates the step-by-step construction of a complex object from its final representation. It is useful when an object has many optional values, validation rules, or construction steps.

31
JuniorBeginner

When should you use the Builder Pattern instead of a constructor?

Use a builder when construction has many optional parameters, requires a meaningful sequence of steps, or benefits from a fluent domain-specific API. It can also centralize validation before the final object is created.

32
JuniorBeginner

What is the Singleton Pattern?

The Singleton Pattern ensures that a type has a single shared instance within a defined process or scope and provides access to that instance. Classic implementations manage construction themselves through a static property.

33
JuniorBeginner

What are the disadvantages of the Singleton Pattern?

A global singleton can hide dependencies, introduce shared mutable state, make tests influence one another, and complicate concurrency. It can also tightly couple application code to a concrete global instance.

34
JuniorBeginner

What is the Prototype Pattern?

The Prototype Pattern creates new objects by copying an existing prototype rather than constructing each object from scratch. It is useful when initialization is expensive or when many objects share a configured starting state.

35
JuniorBeginner

What is the Observer Pattern?

The Observer Pattern establishes a one-to-many relationship in which observers are notified when a subject changes or an event occurs. It reduces the need for the publisher to know concrete details about every consumer.

36
JuniorBeginner

What is the difference between the Observer Pattern and C# events?

Observer is the design concept: a publisher notifies interested subscribers about changes. C# events are a language mechanism that can implement that concept using delegates and controlled subscription.

37
JuniorBeginner

What is the Command Pattern?

The Command Pattern encapsulates a request as an object. The object can contain the information needed to perform an operation and can be passed, queued, logged, retried, or decorated independently of the caller.

38
JuniorBeginner

What are common advantages of the Command Pattern?

Commands make application actions explicit and can separate invocation from execution. This can simplify validation, logging, authorization, transactions, queues, retries, and testing around individual use cases.

39
JuniorBeginner

What is the Mediator Pattern?

The Mediator Pattern centralizes communication between collaborating objects so they do not need direct references to one another. Participants communicate through a mediator, which coordinates the interaction.

40
JuniorBeginner

What is the difference between Mediator and Observer?

Mediator coordinates interactions through a central collaboration object. Observer broadcasts notifications from a subject to interested subscribers, usually without the publisher coordinating a complete multi-object workflow.

41
Mid-LevelIntermediate

What is the Template Method Pattern?

The Template Method Pattern defines the overall sequence of an algorithm in a base type while allowing subclasses to customize selected steps. The invariant workflow remains in the base class.

42
Mid-LevelIntermediate

What is the State Pattern?

The State Pattern lets an object change its behavior when its internal state changes by delegating state-specific behavior to separate state objects. This can replace large conditionals that repeatedly check status.

43
Mid-LevelIntermediate

What is the Chain of Responsibility Pattern?

The Chain of Responsibility Pattern passes a request through a sequence of handlers. Each handler can process the request, enrich it, reject it, or pass it to the next handler.

44
Mid-LevelIntermediate

What is the Iterator Pattern?

The Iterator Pattern provides a way to traverse elements of a collection without exposing the collection's internal representation. The caller works through a traversal abstraction instead of managing storage details.

45
Mid-LevelIntermediate

What is the Memento Pattern?

The Memento Pattern captures an object's internal state so it can be restored later without exposing all of its internal implementation. It is commonly associated with undo, snapshots, or rollback of in-memory state.

46
Mid-LevelIntermediate

What is the Visitor Pattern?

The Visitor Pattern separates operations from the object structure on which they operate. Objects accept a visitor, and different visitors can implement new operations without modifying every element class.

47
Mid-LevelIntermediate

What is the Null Object Pattern?

The Null Object Pattern supplies an object with neutral behavior instead of repeatedly checking for null. The null object implements the expected interface but performs a harmless default action.

48
Mid-LevelIntermediate

What is the Specification Pattern?

The Specification Pattern encapsulates a business rule or selection criterion in a reusable object. Specifications can sometimes be combined using AND, OR, or NOT operations to build more complex rules.

49
Mid-LevelIntermediate

What is the Dependency Injection Pattern in .NET applications?

Dependency Injection supplies a class with its collaborators from the outside rather than letting the class construct those collaborators directly. Constructor injection is the most common form because required dependencies are explicit.

50
Mid-LevelIntermediate

How do SOLID principles and design patterns work together?

SOLID principles describe desirable dependency and responsibility characteristics, while design patterns provide reusable structures for recurring design problems. Patterns such as Strategy, Decorator, Factory, and Adapter can help implement SOLID principles when the problem genuinely requires them.