Design Patterns- final MCQ test

Design Patterns- final MCQ test

Assessment

Quiz

Computers

University

Hard

Created by

Dr. 1229

Used 34+ times

FREE Resource

Student preview

quiz-placeholder

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which text below describes the Template Method pattern best?
Encapsulates interchangeable behaviours and uses delegation to decide which one to use.
Simplifies the interface of a group of classes.
Subclasses decide how to implement steps in an algorithm.
Changes the interface of one or more classes.
Allows (a group of) objects to be notified when some state changes.

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which text below describes the Strategy Pattern best?
Encapsulates interchangeable behaviours and uses delegation to decide which one to use.
Simplifies the interface of a group of classes.
Provides a way to traverse a collection of objects without exposing the collection's implementation.
Changes the interface of one or more classes.
Client treats collections of objects and individual objects uniformly.

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Identify the aspects of your application that vary and separate them from what stays the same. What does that mean?
Define a super class for what varies and let what stays the same extend that super class.
Take what varies and "encapsulate" it so it won't affect the rest of the code.
Put what varies and what stays the same together. Do it so that starting with an abstract class, all other classes inherit in a clever way.
The number of classes should be identical with the number of interfaces.

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is a proper design principle?
Use abstract classes to implement what varies.
Put what varies and what stays the same together. Do ti so that starting with an abstract class, all other classes inherit in a clever way.
Program to an interface, not an implementation.
The number of classes should be identical with the number of interfaces.

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Favour composition over inheritance. What does that mean?
HAS-A can be better than IS-A.
IS-A can be better than HAS-A.
Do not use abstract classes.
The number of classes should be identical with the number of interfaces.

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image
Have a look at the class diagram for the Strategy pattern. What are the appropriate names for the classes?
1. Context 2. Strategy 3. ConcreteStrategyB 4. ConcreteStrategyA
1. Strategy 2. StrategyInterface 3. StrategyInterfaceImplA 4. StrategyInterfaceImplB

7.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which text below describes the Observer Pattern best?
Allows (a group of) objects to be notified when some state changes.
Provides a way to traverse a collection of objects without exposing the collection's implementation.
Changes the interface of one or more classes.
Simplifies the interface of a group of classes.
Encapsulates interchangeable behaviours and uses delegation to decide which one to use.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?