Q.Which of the following statements is true about dictionaries in Python ? (A) A dictionary is an example of sequence datatype. (B) A dictionary cannot have two elements with same key. (C) A dictionary cannot have two elements with same value. (D) The key and value of an element cannot be the same.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Dictionaries are mappings, not sequences; keys must be unique, but values can repeat, and a key can equal its value. Only statement (B) is correct.
The Concept: What a Dictionary Actually Is
A Python dictionary is a mapping type — it stores key-value pairs, where each key is used to look up its associated value. This is fundamentally different from a sequence (like a list, tuple, or string), which stores items in a positional order. Sequences are indexed by integers; dictionaries are indexed by their keys.
The core rules are:
- Keys must be unique — you cannot have two entries with the same key.
- Keys must be immutable (strings, numbers, tuples of immutables).
- Values have no restrictions — they can be any object, and they can repeat freely.
- There is no rule that a key and its value must be different.
Now let’s test each statement against these rules.
Step-by-Step Analysis
1. Statement (A): “A dictionary is an example of sequence datatype.”
A sequence is an ordered collection where elements are accessed by their position (index). Lists, tuples, and strings are sequences. A dictionary is unordered (in Python <3.7) or insertion-ordered (Python ≥3.7), but it is not accessed by integer index — it is accessed by key. It belongs to the mapping category, not sequence.
Therefore, (A) is false.
2. Statement (B): “A dictionary cannot have two elements with the same key.”
This is the defining rule of dictionaries. If you try to assign a value to an existing key, the old value is overwritten — you never get two entries with the same key. For example:
d = {'a': 1, 'a': 2} # This results in {'a': 2}, not two 'a' entries
The language enforces key uniqueness. So (B) is true. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.