
Name __________________________________________
Answer 9 of the following questions. Indicate which of the questions you wish to be graded.
Answer essay questions as briefly as possible.
1. What design pattern should you think of first when you:
A. Want to implement undo.
B. Have a design that requires a tree of objects.
C. Want to reuse an object but it has the wrong interface.
2. The text claims that three design patterns help overcome the inability to alter classes con-
veniently. List two of the design patterns that help overcome the inability to alter classes
conveniently.
3. List one benefit and one liability of the Decorator pattern.
4. Some authors consider the Proxy and Decorator patterns to be similar. In what ways are
the two patterns similar?
5. Explain the benefits and disadvantages of using the Null object pattern in implementing a
Binary Search tree.
6. Explain one of the following types of coupling: Data Coupling, Control Coupling, Inside In-
ternal Object Coupling.
7. Explain one of the following types of cohesion: Logical, Temporal, Procedural, Communica-
tion, Sequential. Give an example.
8. The design patterns text uses two main design principles. Select one pattern that uses both
principles. Show how it uses both.
9. You now have implemented three different ways to find all elements of a tree with a given
digital sum. Select two of the methods and and contrast the coupling and cohesion of the
two methods.
10.Select one of the patterns Visitor or Composite and explain how the pattern works.
11.Implement an External iterator on an array.
5/14/09!CS 635 Midterm!Page 1 of 3