LLD - Design — Online Shopping CartWhich of the following is the correct way to represent a discount of 20% in a pricing system?Adiscount = 20Bdiscount = 2Cdiscount = 0.2Ddiscount = 200Check Answer
Step-by-Step SolutionSolution:Step 1: Understand percentage representation in codePercentages are usually represented as decimals for calculations, so 20% is 0.2.Step 2: Check each optiondiscount = 0.2 uses 0.2 which is correct; others are incorrect as they represent wrong values.Final Answer:discount = 0.2 -> Option CQuick Check:20% = 0.2 decimal [OK]Quick Trick: Use decimal for percentage (20% = 0.2) [OK]Common Mistakes:MISTAKESUsing whole number 20 instead of decimalConfusing 2 or 200 as percentageNot converting percentage to decimal
Master "Design — Online Shopping Cart" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Event-driven design - Quiz 1easy Design — Chess Game - Why chess tests polymorphism and strategy - Quiz 9hard Design — Chess Game - Why chess tests polymorphism and strategy - Quiz 4medium Design — Food Delivery System - Order tracking state machine - Quiz 10hard Design — Food Delivery System - Notification to all parties - Quiz 1easy Design — Hotel Booking System - Availability checking - Quiz 7medium Design — Hotel Booking System - Search and filter design - Quiz 1easy Design — Hotel Booking System - Room type hierarchy - Quiz 10hard Design — Online Shopping Cart - Why e-commerce tests real-world complexity - Quiz 2easy Design — Splitwise (Expense Sharing) - User, Group, Expense classes - Quiz 10hard