Software Design Patterns

Test your knowledge of software design patterns including GoF patterns (Observer, Facade, Composite, Adapter, Singleton, Command, State) and GRASP patterns (Information Expert, Indirection, Polymorphism, Pure Fabrication), plus MVC architecture concepts.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How many GRASP patterns are there?

  1. 5
  2. 6
  3. 9
  4. 10
Question 2 Multiple Choice (Single Answer)

The Gang-of-Four (GoF) pattern is a set of

  1. 9
  2. 23
  3. 20
  4. 10
Question 3 Multiple Choice (Single Answer)

What are the categories of GoF patterns

  1. Conditional, Structural, Behavioral
  2. Ceational, Structural, Behavioral
  3. Factory, Command, Strategy
  4. Behavioral, Observer, Factory
Question 4 Multiple Choice (Single Answer)

The Singleton pattern:

  1. Defines multiple access points for a singleton
  2. supports multiple visibility forms for a singleton
  3. allows the creation of multiple class instances in the future without affecting the clients of the singleton class
  4. All of the above
Question 5 Multiple Choice (Single Answer)

Which GRASP patterns are supported by Adapter pattern

  1. Low coupling, High cohesion
  2. High Cohesion, Indirection
  3. Low Coupling, Polymorphism
  4. High Cohesion, Polymorphism
Question 6 Multiple Choice (Single Answer)

Key Concept for applying the Composite Pattern:

  1. Allows you to represent composite objects in the form of a hierarchy
  2. It uses independent interfaces for representing individual and composite objects
  3. It uses an individual object that is composed of two or more composite objects
  4. It represents just a collection of different objects
Question 7 Multiple Choice (Single Answer)

Key concept for using Facade pattern:

  1. Adapter pattern is used to access facades
  2. The Adapter pattern adds an indirection object for low coupling
  3. The Façade pattern hides the complexity of a subsystem from a client
  4. None of the above
Question 8 Multiple Choice (Single Answer)

The Pure Fabrication pattern

  1. Assigns responsibility to an intermediate object
  2. Creates a convenient class that supports high cohesion and low coupling
  3. Creates a convenient class that supports low cohesion and high coupling
  4. Protects the system from unexpected variations
Question 9 Multiple Choice (Single Answer)

GRASP Patterns generally provide

  1. Solutions to common problems
  2. Guiding Principles for designing a system
  3. General concepts of designing
  4. None of the above
Question 10 Multiple Choice (Single Answer)

The Polymorphism Pattern:

  1. Handles the message generated when a system event or operation takes place
  2. assigns the responsibility for creating new class instance or object
  3. Determine how a system handles conditional variations
  4. Creates a convenient class
Question 11 Multiple Choice (Single Answer)

The Indirection Pattern helps:

  1. Avoid direct coupling
  2. Maintain low coupling and high reusability
  3. None of the above
  4. Both A and B
Question 12 Multiple Choice (Single Answer)

The Information Expert Pattern:

  1. Is used in the process of alternative evaluation
  2. Determine how a system handles conditional variations
  3. Assign responsibilities to an intermediate object
  4. Defines guiding principles for assigning responsibilities to objects
Question 13 Multiple Choice (Single Answer)

Key Concept for applying the Command Pattern:

  1. It helps achieve proper fucntionality if the tasks are ordered
  2. it is mandatory that the sequence added to a transaction must be the best execution sequence possible
  3. The number of tasks to be executed affects the overall performance of a transaction
  4. None of the above
Question 14 Multiple Choice (Single Answer)

Key Concept for applying a State Pattern:

  1. Modifying a persistent object results in the instance update of the database
  2. Only one persistent object can refer to an instance of a class at any given time
  3. The transactional state of an object decides the response to an operation
  4. None of the above
Question 15 Multiple Choice (Single Answer)

It is easy to integrate a new client with the MVC Pattern because

  1. The model, view and the controller objects are independent of each other and can be easily used to integrate a new client's business logic
  2. The new client can be coded into the controller as additional business logic for the enterprise data
  3. The MVC pattern makes provisions for any new client at the time of development of the enterprise solution
  4. The MVC Pattern provides for many models to be used by one controller, thus making it easy to incorporate a new client
Question 16 Multiple Choice (Single Answer)

Identify a benefit of using the Model-View separation principle:

  1. Separation makes more space available for application and interface objects
  2. Separation ensures independence of business logic
  3. Separation is used for repeated testing of the code
  4. Separation makes it easier for the model and the view to define roles in times of performance
Question 17 Multiple Choice (Single Answer)

Identify a concept which is NOT related to MVC pattern among the below:

  1. The MVC pattern introduces extra classes due to the separation of the model,view and the controller components
  2. The view component accesses the enterprise data through the model component
  3. The model-view separation principle states that the application logic should not be put in the UI object method
  4. The Model-View separation principle helps minimize the impact of requirement change in the interface on the controller layer
Question 18 Multiple Choice (Single Answer)

Representing object as Tables Persistence pattern __________________________________

  1. Provides a uniform interface to the subsystem
  2. Defines a table for each persistent object class
  3. Assigns an object identifier for each record
  4. Makes a class resonsible for materialization
Question 19 Multiple Choice (Single Answer)

PersistenceFacade pattern _________________________

  1. Provides a uniform interface to the subsystem
  2. Assigns the responsibility for creating new class instance or object
  3. Makes a class responsible for materialization
  4. Makes the database mappers responsible for maintaining cache
Question 20 Multiple Choice (Single Answer)

The Observer pattern:

  1. Is a behavioral pattern that defines how a single class can be notified of a change
  2. Consider the objects displaying the data and the objects containing the data as a single entity.
  3. Is also known as the publish-subscribe model where an object can publish an event that has no subscribers
  4. None of the above