Bird
0
0

Given this test snippet for Splitwise financial logic:

medium📝 Analysis Q13 of 15
LLD - Design — Splitwise (Expense Sharing)
Given this test snippet for Splitwise financial logic:
initial_balance = 100
expense = 40
new_balance = initial_balance - expense
assert new_balance == 60

What will happen if the assertion fails?
AThe test passes silently
BAn error is raised indicating a failed test
CThe app crashes permanently
DThe balance is automatically corrected
Step-by-Step Solution
Solution:
  1. Step 1: Understand assertion behavior

    An assertion checks if a condition is true; if false, it raises an error.
  2. Step 2: Connect assertion failure to test result

    If the assertion fails, the test framework reports an error indicating failure.
  3. Final Answer:

    An error is raised indicating a failed test -> Option B
  4. Quick Check:

    Assertion fail = Error raised [OK]
Quick Trick: Remember assert stops test on failure [OK]
Common Mistakes:
  • Thinking assertion failure passes silently
  • Assuming app crashes permanently
  • Believing balance auto-corrects

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes