0
0
LLDsystem_design~20 mins

Hotel, Room, Booking classes in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Hotel Booking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Identify the correct relationship between Hotel, Room, and Booking classes

Consider a system with three classes: Hotel, Room, and Booking. Which of the following best describes their relationship?

AA Booking contains multiple Hotels; each Hotel has one Room.
BA Hotel contains multiple Rooms; each Room can have multiple Bookings over time.
CA Room contains multiple Hotels; each Booking is linked to one Room.
DA Booking contains multiple Rooms; each Room belongs to multiple Hotels.
Attempts:
2 left
💡 Hint

Think about real-life hotels: one hotel has many rooms, and rooms can be booked multiple times.

Architecture
intermediate
2:00remaining
Choose the best class design for Booking to avoid double booking

Which Booking class design best prevents double booking of the same Room for overlapping dates?

ABooking stores roomId and a single date; system allows multiple bookings on the same date.
BBooking stores only roomId; no date information is stored.
CBooking stores startDate and endDate but no roomId; system assumes one room per hotel.
DBooking stores roomId, startDate, endDate; system checks existing bookings for overlaps before confirming.
Attempts:
2 left
💡 Hint

To avoid double booking, you must track both the room and the booking dates.

scaling
advanced
2:30remaining
Scaling the Booking system for thousands of hotels and millions of bookings

What is the best approach to scale the Booking system to handle millions of bookings across thousands of hotels?

AUse a distributed database sharded by hotelId and cache frequently accessed room availability.
BStore all bookings in a single database table without indexing for simplicity.
CUse local files on each server to store bookings to avoid database overhead.
DKeep all booking data in memory on one server to speed up access.
Attempts:
2 left
💡 Hint

Think about how to distribute load and speed up queries for large data.

tradeoff
advanced
2:00remaining
Tradeoff between consistency and availability in Booking system

In a distributed Booking system, what is the main tradeoff when choosing between strong consistency and high availability?

AStrong consistency may reduce availability during network partitions but prevents double bookings.
BHigh availability always guarantees no double bookings even with network failures.
CStrong consistency allows the system to ignore network partitions and always accept bookings.
DHigh availability means the system will reject all bookings during network issues.
Attempts:
2 left
💡 Hint

Consider what happens if parts of the system cannot communicate.

component
expert
3:00remaining
Design component interaction for booking a room in Hotel system

Which sequence correctly describes the interaction flow when a user books a room?

A1,3,2,4
B2,1,3,4
C1,2,3,4
D3,2,1,4
Attempts:
2 left
💡 Hint

Think about the logical order of actions from user input to confirmation.