Bird
0
0

Given this pseudocode for refund calculation:

medium📝 Analysis Q13 of 15
LLD - Design — Hotel Booking System
Given this pseudocode for refund calculation:
if cancellation_time <= allowed_cancellation_time:
    refund_amount = full_price
else:
    refund_amount = 0
print(refund_amount)

What will be printed if cancellation_time is after allowed_cancellation_time?
AError
Bfull_price
C0
Dnull
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the condition

    If cancellation_time is after allowed_cancellation_time, the else branch runs.
  2. Step 2: Determine refund amount

    In else, refund_amount is set to 0, so 0 will be printed.
  3. Final Answer:

    0 -> Option C
  4. Quick Check:

    Late cancellation = zero refund [OK]
Quick Trick: Late cancellations get zero refund [OK]
Common Mistakes:
  • Assuming refund is full regardless of time
  • Expecting an error due to condition
  • Confusing variable names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes