Bird
0
0

Why is it important for the Booking class to maintain a reference to the Room object instead of just storing the room number?

hard📝 Conceptual Q10 of 15
LLD - Design — Hotel Booking System
Why is it important for the Booking class to maintain a reference to the Room object instead of just storing the room number?
ATo avoid creating Room objects
BTo access and update room availability and details directly
CBecause room number is not unique
DTo reduce memory usage by storing fewer details
Step-by-Step Solution
Solution:
  1. Step 1: Understand object references

    Storing a reference to Room allows Booking to access and modify room properties.
  2. Step 2: Benefits of direct access

    Direct reference enables updating availability and retrieving room details easily.
  3. Step 3: Evaluate other options

    Room number alone is insufficient for updates; memory usage and uniqueness are not main reasons.
  4. Final Answer:

    To access and update room availability and details directly -> Option B
  5. Quick Check:

    Reference enables direct room updates [OK]
Quick Trick: Reference lets Booking update Room properties directly [OK]
Common Mistakes:
  • Thinking room number is enough for updates
  • Assuming memory saving is main reason
  • Confusing uniqueness of room number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes