Challenge - 5 Problems
Parking Lot Class Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Identify the primary responsibility of the ParkingLot class
In a parking lot system, which of the following best describes the main responsibility of the ParkingLot class?
Attempts:
2 left
💡 Hint
Think about which class would oversee the entire parking structure.
✗ Incorrect
The ParkingLot class manages the entire parking facility, including multiple floors and parking spots. Other classes represent smaller components.
🧠 Conceptual
intermediate1:30remaining
Which class should handle vehicle parking logic?
In the parking lot system, which class is best suited to handle the logic of parking a vehicle into a spot?
Attempts:
2 left
💡 Hint
Consider which class represents the place where a vehicle actually parks.
✗ Incorrect
The Spot class represents a parking spot and should handle parking and freeing the spot for vehicles.
❓ Architecture
advanced2:00remaining
Determine the correct relationship between Floor and Spot classes
Which of the following best describes the relationship between Floor and Spot classes in a parking lot system?
Attempts:
2 left
💡 Hint
Think about how floors and spots are organized in a real parking lot.
✗ Incorrect
A Floor contains many Spot objects, each representing a parking space on that floor.
❓ scaling
advanced2:30remaining
Scaling the ParkingLot system for multiple vehicle types
To support different vehicle types (car, motorcycle, truck) with different spot sizes, which class should be extended or modified?
Attempts:
2 left
💡 Hint
Consider where vehicle size and spot size compatibility should be checked.
✗ Incorrect
Vehicle class should include type and size, and Spot should verify if it can accommodate the vehicle type before parking.
❓ tradeoff
expert3:00remaining
Choosing the best class to track parking spot availability efficiently
For efficient tracking of available parking spots in a large parking lot, which class should maintain the availability data and why?
Attempts:
2 left
💡 Hint
Think about balancing data centralization and query efficiency.
✗ Incorrect
Having each Floor maintain availability reduces the complexity at ParkingLot level and allows faster queries per floor.
