Skip to content
Sharp

Design patterns · interview question

Which of the following best describes the role of the component interface in the Decorator pattern?

Multiple choiceEasychapter-13-curatedpremiumdesign-patternsdecorator-pattern
Choose one answer
Answer and explanation

Correct answer

C. Defines the methods that both the concrete component and decorators must implement

Why

The component interface defines the methods that both the concrete component and all decorators must implement, ensuring that decorated objects can be used interchangeably with undecorated ones.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →