Search Header Logo

Design Patterns- final MCQ test

Authored by Dr. 1229

Computers

University

Used 34+ times

Design Patterns- final MCQ test
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers