Bird
0
0

Which of the following is the correct way to represent a parking spot in a low-level design for a parking lot?

easy🧠 Conceptual Q12 of 15
LLD - Design — Parking Lot System
Which of the following is the correct way to represent a parking spot in a low-level design for a parking lot?
Afunction ParkingSpot() { return spotNumber + spotType; }
Bclass ParkingSpot { int spotNumber; String spotType; boolean isOccupied; }
Cvar ParkingSpot = [spotNumber, spotType, isOccupied];
DParkingSpot = spotNumber * spotType * isOccupied;
Step-by-Step Solution
Solution:
  1. Step 1: Identify proper class structure for parking spot

    A parking spot should be modeled as a class with attributes like spot number, type, and occupancy status.
  2. Step 2: Evaluate options for correctness

    class ParkingSpot { int spotNumber; String spotType; boolean isOccupied; } defines a class with clear attributes, suitable for LLD. Others are either functions, arrays, or invalid expressions.
  3. Final Answer:

    class ParkingSpot { int spotNumber; String spotType; boolean isOccupied; } -> Option B
  4. Quick Check:

    Class with attributes = correct parking spot model [OK]
Quick Trick: Use classes with clear attributes for entities [OK]
Common Mistakes:
MISTAKES
  • Using arrays or functions instead of classes
  • Mixing data types incorrectly
  • Not including occupancy status

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes