Bird
0
0

A rating system stores average rating and count per product. After deleting a review, the average becomes incorrect. What is the likely cause?

medium📝 Analysis Q14 of 15
LLD - Design — Food Delivery System
A rating system stores average rating and count per product. After deleting a review, the average becomes incorrect. What is the likely cause?
ARecalculating average using sum of all reviews
BUsing integer division instead of float division
CNot updating the count of reviews after deletion
DStoring reviews in a hash map
Step-by-Step Solution
Solution:
  1. Step 1: Understand average calculation

    Average = sum of ratings / count of reviews. Both must be accurate.
  2. Step 2: Identify deletion impact

    If count is not decreased after deleting a review, average calculation divides by wrong count.
  3. Final Answer:

    Not updating the count of reviews after deletion -> Option C
  4. Quick Check:

    Count mismatch causes wrong average [OK]
Quick Trick: Always update count when reviews change [OK]
Common Mistakes:
  • Ignoring count update after deletion
  • Assuming recalculation always fixes average
  • Confusing data structure choice with calculation error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes