-
Which design pattern ensures a class has only one instance and provides a global point of access to it?
- a) Singleton
- b) Factory Method
- c) Adapter
- d) Observer
- Answer: a) Singleton
-
Which design pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes?
- a) Abstract Factory
- b) Builder
- c) Prototype
- d) Singleton
- Answer: a) Abstract Factory
-
Which design pattern allows an object to alter its behavior when its internal state changes?
- a) State
- b) Strategy
- c) Observer
- d) Command
- Answer: a) State
-
Which design pattern encapsulates a request as an object, thereby allowing for parameterization of clients with queues, requests, and operations?
- a) Command
- b) Chain of Responsibility
- c) Observer
- d) Mediator
- Answer: a) Command
-
Which design pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable?
- a) Strategy
- b) State
- c) Command
- d) Template Method
- Answer: a) Strategy
-
Which design pattern represents an operation to be performed on elements of an object structure?
- a) Visitor
- b) Composite
- c) Decorator
- d) Proxy
- Answer: a) Visitor
-
Which design pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation?
- a) Iterator
- b) Composite
- c) Builder
- d) Prototype
- Answer: a) Iterator
-
Which design pattern combines objects into tree structures to represent part-whole hierarchies?
- a) Composite
- b) Decorator
- c) Adapter
- d) Proxy
- Answer: a) Composite
-
Which design pattern provides a unified interface to a set of interfaces in a subsystem?
- a) Facade
- b) Adapter
- c) Bridge
- d) Proxy
- Answer: a) Facade
-
Which design pattern converts the interface of a class into another interface that a client expects?
- a) Adapter
- b) Bridge
- c) Facade
- d) Proxy
- Answer: a) Adapter
-
Which design pattern separates an object’s interface from its implementation so they can vary independently?
- a) Bridge
- b) Adapter
- c) Composite
- d) Decorator
- Answer: a) Bridge
-
Which design pattern provides a surrogate or placeholder for another object to control access to it?
- a) Proxy
- b) Adapter
- c) Facade
- d) Bridge
- Answer: a) Proxy
-
Which design pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically?
- a) Observer
- b) Mediator
- c) State
- d) Strategy
- Answer: a) Observer
-
Which design pattern allows subclasses to redefine certain steps of an algorithm without changing the algorithm’s structure?
- a) Template Method
- b) Strategy
- c) State
- d) Command
- Answer: a) Template Method
-
Which design pattern ensures that a class has only one instance and provides a global point of access to it?
- a) Singleton
- b) Factory Method
- c) Adapter
- d) Observer
- Answer: a) Singleton
-
Which design pattern creates objects without specifying the exact class of object that will be created?
- a) Factory Method
- b) Singleton
- c) Adapter
- d) Observer
- Answer: a) Factory Method
-
Which design pattern provides a way to create a tree of objects in which individual objects and composites of objects are treated uniformly?
- a) Composite
- b) Decorator
- c) Adapter
- d) Proxy
- Answer: a) Composite
-
Which design pattern lets you create objects step by step, separating the construction of a complex object from its representation?
- a) Builder
- b) Prototype
- c) Singleton
- d) Factory Method
- Answer: a) Builder
-
Which design pattern allows an object to change its behavior when its internal state changes?
- a) State
- b) Strategy
- c) Observer
- d) Command
- Answer: a) State
-
Which design pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern allows multiple objects to share a single instance to save resources?
- a) Flyweight
- b) Prototype
- c) Singleton
- d) Factory Method
- Answer: a) Flyweight
-
Which design pattern decouples the sending of a request from its receiving, giving multiple objects a chance to handle the request?
- a) Chain of Responsibility
- b) Command
- c) Observer
- d) Mediator
- Answer: a) Chain of Responsibility
-
Which design pattern encapsulates an algorithm inside a class, making the algorithm interchangeable with other algorithms?
- a) Strategy
- b) State
- c) Command
- d) Template Method
- Answer: a) Strategy
-
Which design pattern provides a way to create a family of related objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern provides a way to access the elements of a collection sequentially without exposing its underlying representation?
- a) Iterator
- b) Composite
- c) Builder
- d) Prototype
- Answer: a) Iterator
-
Which design pattern encapsulates a request as an object, allowing for parameterization of clients with queues, requests, and operations?
- a) Command
- b) Chain of Responsibility
- c) Observer
- d) Mediator
- Answer: a) Command
-
Which design pattern separates the construction of a complex object from its representation, allowing the same construction process to create different representations?
- a) Builder
- b) Prototype
- c) Abstract Factory
- d) Singleton
- Answer: a) Builder
-
Which design pattern provides a way to create a tree of objects in which individual objects and composites of objects are treated uniformly?
- a) Composite
- b) Decorator
- c) Adapter
- d) Proxy
- Answer: a) Composite
-
Which design pattern allows an object to change its behavior when its internal state changes?
- a) State
- b) Strategy
- c) Observer
- d) Command
- Answer: a) State
-
Which design pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern allows multiple objects to share a single instance to save resources?
- a) Flyweight
- b) Prototype
- c) Singleton
- d) Factory Method
- Answer: a) Flyweight
-
Which design pattern decouples the sending of a request from its receiving, giving multiple objects a chance to handle the request?
- a) Chain of Responsibility
- b) Command
- c) Observer
- d) Mediator
- Answer: a) Chain of Responsibility
-
Which design pattern encapsulates an algorithm inside a class, making the algorithm interchangeable with other algorithms?
- a) Strategy
- b) State
- c) Command
- d) Template Method
- Answer: a) Strategy
-
Which design pattern provides a way to create a family of related objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern provides a way to access the elements of a collection sequentially without exposing its underlying representation?
-
a) Iterator
-
b) Composite
-
c) Builder
-
d) Prototype
-
Answer: a) Iterator
-
-
Which design pattern encapsulates a request as an object, allowing for parameterization of clients with queues, requests, and operations?
- a) Command
- b) Chain of Responsibility
- c) Observer
- d) Mediator
- Answer: a) Command
-
Which design pattern separates the construction of a complex object from its representation, allowing the same construction process to create different representations?
- a) Builder
- b) Prototype
- c) Abstract Factory
- d) Singleton
- Answer: a) Builder
-
Which design pattern provides a way to create a tree of objects in which individual objects and composites of objects are treated uniformly?
- a) Composite
- b) Decorator
- c) Adapter
- d) Proxy
- Answer: a) Composite
-
Which design pattern allows an object to change its behavior when its internal state changes?
- a) State
- b) Strategy
- c) Observer
- d) Command
- Answer: a) State
-
Which design pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern allows multiple objects to share a single instance to save resources?
- a) Flyweight
- b) Prototype
- c) Singleton
- d) Factory Method
- Answer: a) Flyweight
-
Which design pattern decouples the sending of a request from its receiving, giving multiple objects a chance to handle the request?
- a) Chain of Responsibility
- b) Command
- c) Observer
- d) Mediator
- Answer: a) Chain of Responsibility
-
Which design pattern encapsulates an algorithm inside a class, making the algorithm interchangeable with other algorithms?
- a) Strategy
- b) State
- c) Command
- d) Template Method
- Answer: a) Strategy
-
Which design pattern provides a way to create a family of related objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory
-
Which design pattern provides a way to access the elements of a collection sequentially without exposing its underlying representation?
- a) Iterator
- b) Composite
- c) Builder
- d) Prototype
- Answer: a) Iterator
-
Which design pattern encapsulates a request as an object, allowing for parameterization of clients with queues, requests, and operations?
- a) Command
- b) Chain of Responsibility
- c) Observer
- d) Mediator
- Answer: a) Command
-
Which design pattern separates the construction of a complex object from its representation, allowing the same construction process to create different representations?
- a) Builder
- b) Prototype
- c) Abstract Factory
- d) Singleton
- Answer: a) Builder
-
Which design pattern provides a way to create a tree of objects in which individual objects and composites of objects are treated uniformly?
- a) Composite
- b) Decorator
- c) Adapter
- d) Proxy
- Answer: a) Composite
-
Which design pattern allows an object to change its behavior when its internal state changes?
- a) State
- b) Strategy
- c) Observer
- d) Command
- Answer: a) State
-
Which design pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes?
- a) Abstract Factory
- b) Factory Method
- c) Builder
- d) Prototype
- Answer: a) Abstract Factory