Bird
0
0

Which data representation is most appropriate for storing fine amounts associated with different violation categories in a low-level design?

easy🧠 Conceptual Q3 of 15
LLD - Design — Library Management System

Which data representation is most appropriate for storing fine amounts associated with different violation categories in a low-level design?

AA dictionary or map with violation types as keys and fine amounts as values
BA list of fine amounts without violation types
CA single integer representing the total fine
DA boolean flag indicating if a fine exists
Step-by-Step Solution
Solution:
  1. Step 1: Understand data mapping needs

    Fine amounts must be linked to violation types for lookup.
  2. Step 2: Choose appropriate data structure

    A dictionary/map allows key-value pairs, mapping violation types to fines.
  3. Final Answer:

    Dictionary/map with violation types as keys -> Option A
  4. Quick Check:

    Mapping violation to fine requires key-value pairs [OK]
Quick Trick: Use key-value pairs for violation-fine mapping [OK]
Common Mistakes:
MISTAKES
  • Using list without keys loses violation context
  • Single integer cannot represent multiple fines
  • Boolean flag does not store fine amounts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes