Common Behavioral Patterns - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. Which of the following patterns lets you define a new operation on an object structure without changing the class of the objects?
Please select the best answer.
  A. Chain of Responsibility
  B. Visitor
  C. Strategy
  D. Mediator
  The correct answer is B. The Visitor pattern lets you define a new operation on an object without changing the class.

2. Which of the following patterns allows an object to notify interested listeners of changes to its state?
Please select the best answer.
  A. Chain of Responsibility
  B. Command
  C. Iterator
  D. Observer
  The correct answer is D. The Observer pattern allows an object to notify other objects of any changes.

3. Which of the following patterns allows multiple objects an opportunity to process a request without guaranteeing that any of them must process it?
Please select the best answer.
  A. Chain of Responsibility
  B. Command
  C. Memento
  D. Mediator
  The correct answer is A. The Chain of Responsibility pattern allows multiple objects to process a request without guaranteeing that any of them must process it.

4. Which of the following is an object pattern that encapsulates interchangeable algorithms in objects so the algorithm can vary independently of the classes that use it?
Please select the best answer.
  A. Chain of Responsibility
  B. Command
  C. Strategy
  D. Mediator
  The answer is C. The Strategy pattern encapsulates interchangeable algorithms.