LLD - Behavioral Design Patterns — Part 1Which component in the Strategy pattern defines the common interface for all supported algorithms?AContextBConcreteStrategyCClientDStrategy interfaceCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify Strategy pattern rolesThe Strategy interface declares methods that all concrete strategies must implement.Step 2: Match roles to optionsContext uses the Strategy interface, ConcreteStrategy implements it, and Client uses Context. Only the Strategy interface defines the common contract.Final Answer:Strategy interface -> Option DQuick Check:Common interface = Strategy interface [OK]Quick Trick: Strategy interface defines algorithm contract [OK]Common Mistakes:MISTAKESConfusing Context with interfaceThinking ConcreteStrategy defines interfaceAssuming Client defines algorithm methods
Master "Behavioral Design Patterns — Part 1" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Behavioral Design Patterns — Part 1 - Template Method pattern - Quiz 1easy Behavioral Design Patterns — Part 2 - Memento pattern - Quiz 1easy Behavioral Design Patterns — Part 2 - Visitor pattern - Quiz 4medium Design — Elevator System - Why elevator design tests state machines - Quiz 6medium Design — Library Management System - Notification system - Quiz 14medium Design — Library Management System - Fine calculation - Quiz 12easy Design — Parking Lot System - Why parking lot is a classic LLD problem - Quiz 1easy Design — Tic-Tac-Toe Game - Command pattern for undo - Quiz 13medium Design — Tic-Tac-Toe Game - Extensibility (NxN board, multiple players) - Quiz 8hard Design — Tic-Tac-Toe Game - Command pattern for undo - Quiz 1easy