LLD - Design — Chess GameWhich of the following enum definitions correctly models basic game states in a low-level design?Aenum GameState { MENU, PLAYING, PAUSED, GAME_OVER }Benum GameState { 0: MENU, 1: PLAYING, 2: PAUSED, 3: GAME_OVER }Cenum GameState = { 'MENU', 'PLAYING', 'PAUSED', 'GAME_OVER' }Denum GameState { 'MENU' = 0, 'PLAYING' = 1, 'PAUSED' = 2, 'GAME_OVER' = 3 }Check Answer
Step-by-Step SolutionSolution:Step 1: Understand enum syntaxIn most low-level languages like C or C++, enums are declared as enum Name { VALUE1, VALUE2, ... }.Step 2: Analyze optionsenum GameState { MENU, PLAYING, PAUSED, GAME_OVER } uses correct syntax. enum GameState { 0: MENU, 1: PLAYING, 2: PAUSED, 3: GAME_OVER } uses invalid key-value syntax. enum GameState = { 'MENU', 'PLAYING', 'PAUSED', 'GAME_OVER' } uses assignment with '=', which is incorrect. enum GameState { 'MENU' = 0, 'PLAYING' = 1, 'PAUSED' = 2, 'GAME_OVER' = 3 } uses string keys with assignment, which is invalid in low-level languages.Final Answer:enum GameState { MENU, PLAYING, PAUSED, GAME_OVER } -> Option AQuick Check:Standard enum syntax uses braces and comma-separated identifiers [OK]Quick Trick: Low-level enums use braces and identifiers without quotes [OK]Common Mistakes:MISTAKESUsing key-value pairs inside enums in low-level languagesAssigning string values to enum membersUsing '=' instead of braces for enum declaration
Master "Design — Chess Game" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Why advanced concepts handle production systems - Quiz 7medium Advanced LLD Concepts - Domain-Driven Design basics - Quiz 13medium Design — Chess Game - Observer pattern for UI updates - Quiz 4medium Design — Food Delivery System - Delivery agent assignment - Quiz 5medium Design — Hotel Booking System - Cancellation and refund policy - Quiz 8hard Design — Hotel Booking System - Room type hierarchy - Quiz 15hard Design — Hotel Booking System - Cancellation and refund policy - Quiz 4medium Design — Online Shopping Cart - Notification on state change - Quiz 6medium Design — Splitwise (Expense Sharing) - Balance calculation algorithm - Quiz 9hard Design — Splitwise (Expense Sharing) - Why Splitwise tests financial logic - Quiz 1easy