Bird
0
0

What is the main purpose of using the Parking Strategy Pattern in a parking lot system?

easy🧠 Conceptual Q11 of 15
LLD - Design — Parking Lot System
What is the main purpose of using the Parking Strategy Pattern in a parking lot system?
ATo store vehicle details in a database
BTo manage payment processing for parking fees
CTo allow different algorithms for finding parking spots without changing the main system
DTo control the physical gates of the parking lot
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of strategy pattern

    The strategy pattern lets you swap different algorithms easily without changing the main code.
  2. Step 2: Apply this to parking system context

    In parking, it means you can change how spots are found without rewriting the whole system.
  3. Final Answer:

    To allow different algorithms for finding parking spots without changing the main system -> Option C
  4. Quick Check:

    Strategy pattern = flexible parking spot finding [OK]
Quick Trick: Strategy pattern = flexible algorithm swapping [OK]
Common Mistakes:
MISTAKES
  • Confusing strategy pattern with data storage
  • Thinking it controls hardware like gates
  • Mixing it with payment processing logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes