Bird
0
0

Which of the following is the correct way to represent a fine rate for a violation type in a configuration file?

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

Which of the following is the correct way to represent a fine rate for a violation type in a configuration file?

violation_fine_rates = {
    'speeding': 100,
    'parking': 50,
    'signal_jump': 150
}
AUsing a boolean flag for each violation
BUsing a list of fine amounts only
CUsing a dictionary with violation types as keys and fine amounts as values
DUsing a string with violation names separated by commas
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the data structure

    The example shows a dictionary mapping violation names to their fine amounts, which is clear and easy to update.
  2. Step 2: Compare with other options

    Lists or strings do not map violation types to amounts directly, and booleans cannot store fine values.
  3. Final Answer:

    Using a dictionary with violation types as keys and fine amounts as values -> Option C
  4. Quick Check:

    Dictionary maps violation to fine [OK]
Quick Trick: Use key-value pairs for clear violation-to-fine mapping [OK]
Common Mistakes:
MISTAKES
  • Using lists without keys loses violation context
  • Using strings cannot store amounts
  • Booleans cannot represent fine values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes