《J A V A Design mode 》 Review materials

one , Single choice questions

1. Design patterns originate from ()

A, machine design

B, Architectural engineering design

C, Hydraulic engineering design

D, Industrial electrification design

2.“ Don't talk to strangers. ” yes () Popular expression of principles .

A, Interface isolation

B, Richter substitution

C, Dependency inversion

D, Dimitt 3. At present, common design patterns mainly include () species .

A,23

B,21

C,32

D,28

4. The following statement about the principle of single responsibility is incorrect ().

A, The English name of the single responsibility principle is SingleResponsibilityPrinciple.

B, The single responsibility principle requires a class to have only one responsibility

C, The principle of single responsibility is conducive to the stability of the object , Reduce class complexity

D, The single responsibility principle improves the coupling between classes

5. The following statement about the principle of reliance inversion is incorrect ()

A, The abbreviation of dependency inversion principle is DIP

B, High level modules do not depend on low-level modules , Low level modules depend on high-level modules

C, In the dependency inversion principle, both high-level modules and low-level modules rely on abstraction

D, Rely on inversion principle to realize loose coupling between modules

6. The following statement about singleton mode is wrong ()

A, Singleton mode means that a class has only one instance

B, Singleton classes can be divided into lazy and hungry in terms of implementation

C, The singleton class is divided into state singleton class and stateless singleton class in terms of function

D, You can extend the singleton class by inheritance to get a more functional singleton class 7. The following statement about the factory method mode is wrong ().

A, The factory method pattern delays the instantiation of a class into its subclasses

B, Abstract factory in factory method pattern , Specific factory , Abstract products and concrete products 4 Roles

C, The factory method pattern can handle multiple hierarchical structures of multiple products

D, Factory method patterns can mask product classes

8. The responsibility chain model is not suitable for the following situations ()

A, There are multiple objects that can process requests , Which object handles the request is automatically determined at runtime .

B, When it is necessary to replace simple pointers with general and complex object pointers .

C, You want to specify the receiver , Submit a request to one of multiple objects .

D, A request requires a series of processing work .

9. When we want to create a concrete object without specifying a concrete class , have access to () pattern

A, Structural type

B, Create type

C, Behavioral type

D, All the above are OK

10. The following describes the adapter pattern ()

Technology