Bird
0
0

Which component in the Parking Strategy Pattern decides how to find a parking spot?

easy🧠 Conceptual Q2 of 15
LLD - Design — Parking Lot System
Which component in the Parking Strategy Pattern decides how to find a parking spot?
AParking Lot class
BParking Strategy interface
CVehicle class
DParking Ticket
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of each component

    The Parking Lot manages spots, Vehicle represents cars, Ticket tracks usage, but the Strategy defines the parking logic.
  2. Step 2: Confirm the Strategy's responsibility

    The Parking Strategy interface declares how to find spots, letting different implementations decide the exact method.
  3. Final Answer:

    Parking Strategy interface -> Option B
  4. Quick Check:

    Strategy interface = decides parking logic [OK]
Quick Trick: Strategy interface defines parking logic [OK]
Common Mistakes:
MISTAKES
  • Confusing Parking Lot as decision maker
  • Thinking Vehicle finds spots
  • Assuming Ticket controls parking logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes