Skip to content
Sharp

Design patterns · interview question

Which of the following statements is true regarding the implementation of the Strategy Pattern?

Multiple choiceHardchapter-13-curatedpremiumdesign-patternsstrategy-pattern
Choose one answer
Answer and explanation

Correct answer

C. The context class should depend on a strategy interface, not concrete implementations.

Why

In the Strategy Pattern, the context class should be dependent on a generic strategy interface, allowing for different implementations of strategies without knowing the concrete classes, ensuring flexibility and adherence to the Open/Closed Principle.

Test yourself on Design patterns

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

Start free test
All Design patterns questions →