wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Design Patterns Quiz 01

Total questions: 21

Worksheet time: 15mins

Name
Class
Date
1.

Concerning the solid principle which of these is odd?

a)

Dependency Inversion Principle

b)

Liskov Substitution Principle

c)

Interface Segregation Principle

d)

Single Reconstruction Principle

2.

A specific form of decoupling where conventional dependency relationships are established from high-level, policy-setting modules to low-level, dependency modules are reversed for the purpose of rendering high-level modules independent of the low-level module implementation details.

• High-level modules should not depend on low-level modules; both should depend on abstractions

• Abstractions should not depend on details; details should depend on abstractions

a)

Open/Closed Principle

b)

Liskov Substitution Principle

c)

Single Responsibility Principle

d)

Dependency Inversion Principle

3.

..........'s notion of a behavioral subtype defines a notion of substitutability for mutable objects; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program (e.g., correctness)

a)

Open/Closed Principle

b)

Liskov Substitution Principle

c)

Single Responsibility Principle

d)

Dependency Inversion Principle

4.

Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. That is, such an entity can allow its behavior to be modified without altering its source code.

a)

Open/Closed Principle

b)

Liskov Substitution Principle

c)

Single Responsibility Principle

d)

Dependency Inversion Principle

5.

• Classes that implement interfaces should not be forced to implement methods they do not use. Another way of putting it is: use small interfaces, not fat ones

• Focuses on the cohesiveness of interfaces with respect to the implementors that use them

• Keep each implementation independent of interfaces that they do not use. If you need to change one interface, you shouldn't need to change the other

a)

Open/Closed Principle

b)

Interface Segregation Principle

c)

Liskov Substitution Principle

d)

Single Responsibility Principle

e)

Dependency Inversion Principle

6.

Every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.

a)

Open/Closed Principle

b)

Interface Segregation Principle

c)

Liskov Substitution Principle

d)

Single Responsibility Principle

e)

Dependency Inversion Principle

7.

What is the Interface Segregation Principle?

a)

Classes that implement interfaces should not be forced to implement methods they do not use. Another way of putting it is: use small interfaces, not fat ones

b)

Focuses on the cohesiveness of interfaces with respect to the implementors that use them

c)

Keep each implementation independent of interfaces that they do not use. If you need to change one interface, you shouldn't need to change the other

d)

Classes implementation should only be modified to correct errors; new or changed features would require a subclass be created

8.

What is the Interface Segregation Principle?

a)

Classes that implement interfaces should not be forced to implement methods they do not use. Another way of putting it is: use small interfaces, not fat ones

b)

Focuses on the cohesiveness of interfaces with respect to the implementors that use them

c)

Keep each implementation independent of interfaces that they do not use. If you need to change one interface, you shouldn't need to change the other

d)

High-level modules should not depend on low-level modules; both should depend on abstractions

9.

What is the Dependency Inversion Principle?

A specific form of decoupling where conventional dependency relationships established from high-level, policy-setting modules to low-level, dependency modules are reversed for the purpose of rendering high-level modules independent of the low-level module implementation details.

a)

True

b)

False

10.

The following which is NOT a category of relationships between objects are...

a)

Association

b)

Externalization

c)

Dependency

d)

Generalization

11.

Having a "has-a" relationship which states that a class has relationships with other classes is the meaning of ...

a)

Association

b)

Externalization

c)

Dependency

d)

Generalization

12.

Each class should have only one responsibility and one reason to change. Is the definition of ...

a)

Open Close Principle

b)

Dependency Inversion Principle

c)

Liskov’s Substitution Principle

d)

Single Responsibility Principle

13.

Open / Close Principle is a state when ...

a)

open for change, but closed for new specification

b)

open for access, but closed using private

c)

open for modification, but closed for extension

d)

open for extension, but closed for modification

14.

Many client-specific interfaces are better than one general-purpose interface. Is statement of...

a)

Interface Splitting Principle

b)

Interface Specific Principle

c)

Interface Segregation Principle

d)

Interface Separation Principle

15.

If my class implements an interface with some methods it doesn't use

a)

Those methods should be given an empty implementation

b)

Those methods must be given some implementation

c)

The class needs to be defined as abstract

d)

The interface should be split

16.

Dependency Inversion is all about

a)

Splitting interfaces

b)

Adding an abstraction layer

c)

Assisting dependent classes

d)

Creating abstractions that depend on details

17.

SOLID is a what?

a)

a set of coding guidelines

b)

a type of class diagram

c)

a set of design principles

d)

a software framework

18.

_____ defines how the elements within an module work together.

a)

Modularity

b)

Connectivity

c)

Teamwork

d)

Cohesion

19.

What is the difference between SOLID and OOP?

a)

SOLID is a framework; OOP are concepts.

b)

SOLID is a specific diagram that describes OOP.

c)

OOP is a specific diagram that describes SOLID.

d)

SOLID are design principles; OOP are concepts.

20.

What is coupling?

a)

Coming together of variables

b)

Dependency of class/modules on each other

c)

Stickiness of a class and its methods

d)

Common services

21.

Which is good?

a)

Low Cohesion & Low Coupling

b)

High Cohesion & Low Coupling

c)

Low Cohesion & High Coupling

d)

High Cohesion & High Coupling