QuizzesDesign a Parking Lot — Concept Check
intermediate
lld

Design a Parking Lot — Concept Check

Questions on Design a Parking Lot. Model a multi-floor parking lot that assigns spots based on vehicle size and calculates fees using a pluggable pricing strategy.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Design a Parking Lot — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A truck enters a multi-floor parking lot, but no spots are available. What happens next?

    • AThe truck is parked in a small spot.
    • BThe system waits for a spot to become available.
    • CThe system throws an IllegalStateException.
    • DThe truck is parked in a medium spot.
  2. 2.A car enters the parking lot. Which spot type will it be assigned?

    • AA small spot
    • BA large spot
    • CA medium spot
    • DAny available spot
  3. 3.Which pattern ensures that all floors share one access point in the parking lot?

    • AFactory
    • BStrategy
    • CObserver
    • DSingleton
  4. 4.The pricing strategy needs to change from flat rate to hourly. What must be modified?

    • AThe core logic of ParkingLot
    • BThe ParkingTicket class
    • COnly the PricingStrategy implementation
    • DAll vehicle classes
  5. 5.A motorcycle is parked in a small spot. What happens if a car tries to park there?

    • AThe car parks alongside the motorcycle.
    • BThe car parks, replacing the motorcycle.
    • CThe car cannot park, as the spot is occupied.
    • DThe system throws an exception.
  6. 6.What is the role of the Factory pattern in this parking system?

    • ATo create spot types and vehicle subclasses
    • BTo calculate parking fees
    • CTo manage parking spot assignments
    • DTo ensure thread safety
  7. 7.If a ParkingSpot is vacated, what is the immediate next step?

    • AIt is assigned to the next vehicle in line.
    • BIt becomes available for new vehicles.
    • CIt is removed from the system.
    • DIt triggers a fee calculation.
  8. 8.What ensures thread-safe spot assignment in the parking lot?

    • ALocking each spot individually
    • BAssigning spots randomly
    • CSynchronized methods or ConcurrentHashMap
    • DUsing a single thread for assignments