免费的基本设计模式问答

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!

解释:
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.

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!

解释:
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.

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

Correct! Wrong!

解释:
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.

Which statement regarding the Singleton design pattern is true.

Correct! Wrong!

解释:
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.

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!

解释:
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!

解释:
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

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

Correct! Wrong!

解释:
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 December-2024