CS FundamentalsHardCognizant · Capgemini pattern

A stock-price service must notify every registered display widget whenever the price changes, without knowing the widgets' concrete classes. Which pattern fits?

  1. A. Adapter
  2. B. Observer
  3. C. Builder
  4. D. Singleton

Correct answer: B. Observer

Observer defines a one-to-many dependency: the subject keeps a list of subscribers and calls their update method on each change, staying decoupled from their concrete types.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic