A time ago I prepared this test for a course in the internal training program of the company I worked for. I gave a quick training of design patterns using the most common ones as described in the Gang of Four book. You can get it from my drive in Google, or read it here.
- The follow applicability “a system should be configured with one of multiple families of products.”, describes the pattern:
- Builder
- Decorator
- Singleton
- Abstract Factory
- The diagram below is read as
- A is an aggregate class
- B implements A
- B extends from A
- A is an abstract class
- These two patterns can be used for undo operations.
- Decorator & Visitor
- Memento & Command
- Factory Method & Chain of Responsibility
- Command & Observer
- Loose coupling is when
- A class has just a small number of lines of code
- An application is designed with a small set of classes
- Reflection is used to instance the objects
- A class has little knowledge of another implementing class
- Which pattern uses a pool to share objects instead of instancing an excessive amount of them?
- Adapter
- Flyweight
- Proxy
- None of above
- Which of the follow is a general principle of class designing?
- Favor inheritance over composition
- Avoid polyphormism
- Use only creational patterns
- Favor composition over inheritance
- Incompatible interfaces can be overcome with the pattern:
- Interpreter
- Observer
- Adapter
- Bridge
- Which statements are correct about design patterns?
- They are proven solutions to common design problems
- They benefit code reusability
- They provide a common language among programmers
- All mentioned
- The capacity to add responsibilities on runtime to individual objects, that is, without affecting other objects, can be accomplished with this pattern.
- Decorator
- Proxy
- State
- Façade
- One applicability of the Observer pattern is :
- When a class should have all its attributes declared as public
- When an object should be able to notify others about an event
- When a class should have all its methods declared as public
- All of them
- Which pattern is represented in this diagram?
- Composite
- Prototype
- Façade
- Singleton
- Which pattern is being used in this line of code?
MyPattern s1 = MyPattern.Instance();
- Singleton
- Prototype
- Factory Method
- Command
- Which type of pattern is described in the next sentence: “Are concerned with algorithms and the assignments of responsibilities between objects”
- Creational
- Structural
- Behavioral
- None
- This pattern has two types: virtual & security.
- Façade
- Iterator
- Singleton
- Proxy
- Suppose there is a class that has a request, but you don’t want to hard code the class that will satisfy that request, but more than one class can satisfy it. You will use the follow pattern:
- Façade
- Chain of responsibility
- Proxy
- Command
No comments:
Post a Comment