Bird
0
0
LLDsystem_design~5 mins

Enum usage (VehicleType, SpotType) in LLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an enum and why is it useful in system design?
An enum (short for enumeration) is a special data type that lets you define a set of named constants. It helps make code clearer and safer by restricting values to a fixed set, like types of vehicles or parking spots.
Click to reveal answer
beginner
Give an example of how VehicleType enum might be defined.
VehicleType enum could include values like CAR, BIKE, TRUCK. This helps the system know exactly what types of vehicles it can handle without errors.
Click to reveal answer
intermediate
Why use SpotType enum in a parking system?
SpotType enum defines different parking spot categories like COMPACT, LARGE, HANDICAPPED. It helps assign the right spot to the right vehicle type and manage space efficiently.
Click to reveal answer
intermediate
How do enums improve code maintainability?
Enums centralize the allowed values, so if you need to add or change types, you update in one place. This reduces bugs and makes the system easier to understand and extend.
Click to reveal answer
advanced
What could go wrong if enums are not used for VehicleType or SpotType?
Without enums, invalid or inconsistent values might be used, causing errors or wrong assignments. For example, a BIKE might be assigned a LARGE spot meant for trucks, wasting space.
Click to reveal answer
What does an enum represent in system design?
AA fixed set of named constants
BA variable data type
CA function to process data
DA database table
Which of these is a valid VehicleType enum value?
ACAR
BCOMPACT
CHANDICAPPED
DLARGE
Why is SpotType enum important in parking systems?
ATo assign parking fees
BTo categorize parking spots by size or purpose
CTo track vehicle speed
DTo store vehicle registration
What is a risk of not using enums for VehicleType?
ASystem runs faster
BMore memory usage
CInvalid vehicle types may be used
DBetter user interface
How do enums help maintainability?
ABy increasing code complexity
BBy allowing any value
CBy removing all constants
DBy centralizing allowed values
Explain how enums like VehicleType and SpotType improve a parking system design.
Think about how fixed categories help avoid mistakes.
You got /3 concepts.
    Describe potential problems if enums are not used for vehicle and spot types in a parking system.
    Consider what happens if any string or number is allowed.
    You got /3 concepts.