Questions and CORRECT Answers
What is a VerboseList? - CORRECT ANSWER Used for debugging. Prints a message
each time one of its methods is called.
What is a Bridge design pattern? - CORRECT ANSWER Decouple an abstraction from its
implementation so that the two can vary independently. A bridge lets you combine the different
abstractions and implementations and extend them independently.
What is a class structural? - CORRECT ANSWER Use inheritance to compose interfaces
and implementations
What is object structural? - CORRECT ANSWER Describe ways to compose objects to
realize new functionality. Added flexibility can change composition at run time.
What are the different structural design patterns? - CORRECT ANSWER Adapter, bridge,
composite, decorator, flyweight
What is an adapter design pattern? - CORRECT ANSWER Convert the interface of a class
another interface clients expect. Adapter lets classes work together that couldn't otherwise
because of incompatible interfaces.
What is a flyweight design pattern? - CORRECT ANSWER Use sharing to support large
numbers of fine-grained objects efficiently. A shared object that can be used in multiple contexts
simultaneously. Acts as an independent object in each context.
What is an intrinsic state? - CORRECT ANSWER Stored in the flyweight and information
that is independent from the flyweight's context, thus making it shareable.
What is an extrinsic state? - CORRECT ANSWER Depends on/varies with the flyweights
context and can't be shared.
, What is a decorator design pattern? - CORRECT ANSWER Attach additional
responsibilities to an object dynamically. Decorators provide a flexible alterantive to subclassing
for extending functionality.
What is a composite design pattern? - CORRECT ANSWER Compose objects into tree
structures to represent part-whole hierarchies. Composite lets clients treat individual objects and
compositions of objects uniformly.
What is a behavioural design pattern? - CORRECT ANSWER Concerned with algorithms
and the assignment of responsibilities between objects.
What are the two types of behavioural design patterns? - CORRECT ANSWER Class
behavioural and object behavioural.
What is class behavioural? - CORRECT ANSWER Uses inheritance to distribute
behaviour between classes
What is object behavioural - CORRECT ANSWER Uses object composition rather than
inheritance
What are the behavioural design patterns? - CORRECT ANSWER State, strategy,
observer, command, visitor
What is a state behavioural pattern? - CORRECT ANSWER Allow an object to alter its
behaviour when its internal state changes. The object will appear to change its class.
What is strategy behavioural design pattern? - CORRECT ANSWER Define a family of
algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm
vary independently from clients that use it.