Bird
0
0

Consider the following pseudo-code snippet. What will be the final value of totalFine after execution?

medium📝 Analysis Q4 of 15
LLD - Design — Library Management System

Consider the following pseudo-code snippet. What will be the final value of totalFine after execution?

violations = ["illegalParking", "speeding", "illegalParking"]
fineRates = {"speeding": 120, "illegalParking": 80}
totalFine = 0
for violation in violations:
    totalFine += fineRates[violation]
A320
B280
C240
D200
Step-by-Step Solution
Solution:
  1. Step 1: List violations and their fines

    "illegalParking" = 80, "speeding" = 120
  2. Step 2: Calculate total fine

    Violations: illegalParking (80) + speeding (120) + illegalParking (80) = 80 + 120 + 80 = 280
  3. Final Answer:

    280 -> Option B
  4. Quick Check:

    Sum each violation fine correctly [OK]
Quick Trick: Sum fines for each violation in list [OK]
Common Mistakes:
MISTAKES
  • Adding fines incorrectly
  • Mixing violation names
  • Ignoring repeated violations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes