What is the Singleton design pattern used for?

  • To define a one-to-many dependency between objects so that changes to one object result in changes to many other objects.
  • To enforce a single instance of a class per application.
  • To ensure that a class has only one instance and provide a global point of access to that instance.
  • To provide a way to dynamically instantiate objects of a specified class.
The Singleton design pattern is used to ensure that a class has only one instance and to provide a global point of access to that instance. This can be useful in situations where it is important to have a single instance of a class that provides a shared resource.

What is Adapter Pattern?

  • The Adapter pattern is a design pattern used to aggregate several classes into a single class to simplify the management and organization of code.
  • The Adapter pattern is a design pattern used to convert the interface of one class into another interface that a client is expecting. This allows classes with incompatible interfaces to work together.
  • The Adapter pattern is a design pattern used to create new objects from existing ones by modifying their properties or behavior.
  • The Adapter pattern is a design pattern used to modify the behavior of an existing class to make it meet the requirements of a different interface.
The Adapter pattern is a design pattern used to convert the interface of one class into another interface that a client is expecting. This allows classes with incompatible interfaces to work together.

What is the purpose of the Command pattern?

  • To allow objects to be treated as commands that can be executed, deferred or queued
  • To create complex objects step by step, using a builder object to abstract the process of creating the object
  • To provide a common interface for a group of related classes
  • To provide a simplified interface to a complex system, hiding the complexity of the system behind a single interface
The Command pattern allows objects to be treated as commands that can be executed, deferred or queued

What is the difference between the Abstract Factory and Factory patterns?

  • The Abstract Factory pattern is used to create objects without specifying the exact class of object that will be created, while the Factory pattern is used to provide an interface for creating families of related or dependent objects.
  • The Abstract Factory pattern is used to create singleton objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.
  • The Abstract Factory pattern is used to provide a generic interface for creating objects, while the Factory pattern is used to provide a specific interface for creating objects.
  • The Abstract Factory pattern is used to provide an interface for creating families of related or dependent objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.
The Abstract Factory pattern is used to provide an interface for creating families of related or dependent objects, while the Factory pattern is used to create objects without specifying the exact class of object that will be created.

What is the difference between the Visitor and Iterator patterns?

  • None of the above
  • The Visitor and Iterator patterns are the same
  • The Visitor pattern allows you to add new operations to existing object structures without modifying them, while the Iterator pattern provides a way to access the elements of a collection object in a sequential manner
  • The Visitor pattern provides a way to access the elements of a collection object in a sequential manner, while the Iterator pattern allows you to add new operations to existing object structures without modifying them
The Visitor pattern allows you to add new operations to existing object structures without modifying them, while the Iterator pattern provides a way to access the elements of a collection object in a sequential manner

What is Front Controller pattern?

  • A design pattern to handle communication between objects
  • A design pattern to handle database connections
  • A design pattern to manage the flow of control from a centralized handler
  • A design pattern to provide a unified interface to a set of interfaces
The Front Controller pattern provides a centralized handler for requests coming from the client. It coordinates the work of different request handlers to provide a unified interface for the user.

What is the difference between the Decorator and Proxy patterns?

  • None of the above
  • The Decorator and Proxy patterns are the same
  • The Decorator pattern adds behavior to an object dynamically, while the Proxy pattern provides a substitute for an object to control access to it
  • The Decorator pattern provides a substitute for an object to control access to it, while the Proxy pattern adds behavior to an object dynamically
The Decorator pattern adds behavior to an object dynamically, while the Proxy pattern provides a substitute for an object to control access to it

What is Proxy pattern?

  • A design pattern that allows objects to represent or act on behalf of other objects, providing a level of indirection between the client and the target object
  • A design pattern that creates objects by cloning existing objects, rather than creating new instances from scratch
  • A design pattern that provides a simplified interface to a complex system, allowing the client to interact with the system through a single, unified interface
  • A design pattern that uses shared objects to support large numbers of similar objects efficiently
Proxy pattern is a design pattern that allows objects to represent or act on behalf of other objects, providing a level of indirection between the client and the target object. The pattern involves creating a proxy class that acts as an intermediary between the client and the target object. This pattern can be useful in situations where you want to add additional functionality or control access to an object, without affecting the behavior of the target object.

What is Composite Entity pattern?

  • A design pattern that promotes loose coupling by keeping the presentation layer separate from the business layer
  • A design pattern that provides a simplified interface to a set of services
  • A design pattern that separates the business logic and presentation logic in an application
  • A design pattern used to represent entities that have a tree structure
Composite Entity pattern is used to represent entities that have a tree structure, such as an organizational chart.

What is Memento pattern?

  • A design pattern that allows the client to traverse a collection of objects, without exposing the underlying representation of the collection
  • A design pattern that captures the internal state of an object, allowing the object to be restored to this state later
  • A design pattern that converts a request into a standalone object, allowing the client to parametrize objects with different requests, queue a request, or log requests
  • A design pattern that provides a simplified interface to a complex system, allowing the client to interact with the system through a single, unified interface
The Memento pattern is a design pattern that captures the internal state of an object, allowing the object to be restored to this state later. The Memento pattern is used to capture and store the internal state of an object so that it can be restored at a later time, without violating the object's encapsulation. The Memento pattern is used to implement undo/redo functionality in applications.