Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

  1. Bridge

  2. Iterator

  3. Adaptor

  4. Momento


Correct Option: B

AI Explanation

To access the elements of an aggregate object sequentially without exposing its underlying representation, you can use the Iterator design pattern.

Option A) Bridge - The Bridge pattern is used to decouple an abstraction from its implementation.

Option B) Iterator - This option is correct. The Iterator pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. It allows you to iterate over the elements of a collection without knowing the specific structure of the collection.

Option C) Adapter - The Adapter pattern is used to convert the interface of one class into another interface that clients expect.

Option D) Memento - The Memento pattern is used to capture and restore an object's internal state.

The correct answer is B) Iterator. This option is correct because the Iterator pattern is specifically designed to access the elements of an aggregate object sequentially without exposing its underlying representation.

Find more quizzes: