FREE Basic Design Pattern Question and Answers

0%

Give a subsystem's collection of interfaces a unified interface. It defines a higher level interface that facilitates use of the subsystem.

Correct! Wrong!

Explanation:
The Facade design pattern is notably utilized when a system is extremely complex or challenging to comprehend due to the system's numerous interdependent classes or the lack of the system's source code.

Define an operation that contains the basic structure of an algorithm while leaving some phases to subclasses. It enables subclasses to modify specific algorithmic stages without altering the algorithm's structure.

Correct! Wrong!

Explanation:
A design pattern known as the template method design pattern uses an abstract method known as the template method to provide an abstract definition of an algorithm.

Encapsulate a request as an object to provide undoable operations, parametrize clients with various requests, and queue or log requests.

Correct! Wrong!

Explanation:
A trigger or action can be contained inside an object using the Command design pattern in order to use it afterwards to trigger an event

Which statement regarding the Singleton design pattern is true.

Correct! Wrong!

Explanation:
One of the simplest design patterns in Java is the singleton pattern. This kind of design pattern falls under the category of a creational pattern because it offers one of the finest ways to make an object.

Enables sequential access to the components of an aggregate object without disclosing its underlying representation.

Correct! Wrong!

Explanation:
The Iterator offers methods for systematically gaining access to components of an aggregate object without disclosing the entity's internal structure. Aggregate objects are files. The Iterator pattern is exhibited in office environments when access to files is made through administrative or secretarial staff with the secretary serving as the Iterator.

Establishes an interface for object creation but leaves it up to the subclasses to choose the class to instantiate. It let subclasses' instantiations to vary.

Correct! Wrong!

Explanation:
Just specify an interface or abstract class to create an object, according to the factory pattern or factory method pattern, and then let the subclasses choose which class to instantiate. In other words, subclasses are in charge of producing a class instance.

Dynamically assign extra responsibilities to an object. It offers a versatile substitute for subclassing when it comes to extending functionality.

Correct! Wrong!

Explanation:
In order to increase the utility of classes in object-oriented computer software, a design method known as the decorator design pattern, or decorator pattern for short, was introduced in 1994. The pattern states that any object can be given additional functionality without affecting the functionality of other objects belonging to the same classes.

Premium Tests $49/mo
FREE April-2024