Skip to content

Latest commit

 

History

History
351 lines (300 loc) · 11.7 KB

File metadata and controls

351 lines (300 loc) · 11.7 KB
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. Which design pattern combines objects into tree structures to represent part-whole hierarchies?

    • a) Composite
    • b) Decorator
    • c) Adapter
    • d) Proxy
    • Answer: a) Composite
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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

  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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