Bird
0
0

Which component in the Strategy pattern defines the common interface for all supported algorithms?

easy🧠 Conceptual Q2 of 15
LLD - Behavioral Design Patterns — Part 1
Which component in the Strategy pattern defines the common interface for all supported algorithms?
AContext
BConcreteStrategy
CClient
DStrategy interface
Step-by-Step Solution
Solution:
  1. Step 1: Identify Strategy pattern roles

    The Strategy interface declares methods that all concrete strategies must implement.
  2. Step 2: Match roles to options

    Context uses the Strategy interface, ConcreteStrategy implements it, and Client uses Context. Only the Strategy interface defines the common contract.
  3. Final Answer:

    Strategy interface -> Option D
  4. Quick Check:

    Common interface = Strategy interface [OK]
Quick Trick: Strategy interface defines algorithm contract [OK]
Common Mistakes:
MISTAKES
  • Confusing Context with interface
  • Thinking ConcreteStrategy defines interface
  • Assuming Client defines algorithm methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes