Bird
0
0
LLDsystem_design~5 mins

Parking strategy pattern in LLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the Parking Strategy Pattern?
It is a design approach that helps decide how to park vehicles in a parking lot using different strategies, like parking nearest to the entrance or in the largest free space.
Click to reveal answer
intermediate
Why use the Strategy Pattern in parking systems?
It allows changing parking rules easily without changing the main system. For example, switching from first-come-first-served to reserved parking without big code changes.
Click to reveal answer
beginner
Name two common parking strategies.
1. Nearest Spot First: Park the vehicle in the closest available spot to the entrance.<br>2. Largest Spot First: Park the vehicle in the largest available spot to fit bigger vehicles.
Click to reveal answer
intermediate
How does the Parking Strategy Pattern improve scalability?
By separating parking logic into strategies, the system can add new parking rules without affecting existing code, making it easier to grow and maintain.
Click to reveal answer
intermediate
What role does the Context play in the Parking Strategy Pattern?
The Context is the parking lot system that uses a chosen strategy to decide where to park vehicles. It delegates the decision to the strategy object.
Click to reveal answer
What does the Parking Strategy Pattern help with?
AFixing broken cars
BBuilding physical parking lots
CChoosing different ways to park vehicles
DCalculating parking fees
Which of these is NOT a benefit of using the Parking Strategy Pattern?
AAutomatically cleans the parking lot
BEasier to add new parking rules
CImproves system flexibility
DSeparates parking logic from main system
In the Parking Strategy Pattern, what is the 'Context'?
AThe parking lot entrance
BA vehicle looking for parking
CA parking ticket machine
DThe parking lot system using a strategy
Which strategy might park a vehicle in the closest spot to the entrance?
ALast Spot First
BNearest Spot First
CRandom Spot
DLargest Spot First
How does the Parking Strategy Pattern help when parking rules change?
ABy changing the strategy without rewriting the whole system
BBy rebuilding the parking lot
CBy hiring more parking attendants
DBy increasing parking fees
Explain the Parking Strategy Pattern and how it helps manage parking decisions.
Think about how different parking rules can be swapped easily.
You got /3 concepts.
    Describe the roles of Context and Strategy in the Parking Strategy Pattern with an example.
    Imagine the system choosing where to park based on a rule.
    You got /3 concepts.