Search Header Logo

Design Patterns

Authored by Codecje Codecje

University

Used 361+ times

Design Patterns
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

17 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

What is not a correct statement for the Hollywood Principle?

High-level components control when and how low-level components participate in the computation.
It is a way to prevent dependency rot.
A low-level component never calls a high-level component directly.
Call us, we don't call you.

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

Have a look at the class diagram for the Template Method pattern. What are the appropriate class names?

1. ConcreteClass 2. AbstractClass
1. AbstractClass 2. ConcreteClass

4.

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.

5.

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.

6.

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.

7.

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.

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?