Bird
Raised Fist0

Consider a system where each product stores total rating sum and count. After a new review with rating 4 is added to a product with sum=20 and count=5, what is the new average rating?

medium📝 Analysis Q4 of Q15
LLD - Design — Food Delivery System
Consider a system where each product stores total rating sum and count. After a new review with rating 4 is added to a product with sum=20 and count=5, what is the new average rating?
A5.0
B3.5
C4.0
D4.5
Step-by-Step Solution
Solution:
  1. Step 1: Calculate new sum and count

    New sum = 20 + 4 = 24; new count = 5 + 1 = 6.
  2. Step 2: Compute new average rating

    Average = 24 / 6 = 4.0.
  3. Final Answer:

    4.0 -> Option C
  4. Quick Check:

    Average rating calculation = 4.0 [OK]
Quick Trick: Add new rating to sum, increment count, divide [OK]
Common Mistakes:
MISTAKES
  • Dividing old sum by new count
  • Adding rating but not updating count
  • Using incorrect arithmetic order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes