Question:easy

Which of the following statements is true about dictionaries in Python?

Show Hint

Keys in a dictionary must be unique, but values and key-value equality are not restricted.
Updated On: Oct 20, 2026
  • A dictionary is an example of sequence datatype.
  • A dictionary cannot have two elements with same key.
  • A dictionary cannot have two elements with same value.
  • The key and value of an element cannot be the same.
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Test the statements with small examples:
Take d = {1: 1, 2: 1, 'a': 'a'}. Python accepts it and prints {1: 1, 2: 1, 'a': 'a'}.

Step 2: What this example shows:
The values 1 and 1 repeat, so (C) is false.
Keys 1 and 'a' equal their own values, so (D) is false.

Step 3: Try to repeat a key:
If we write d = {1: 'x', 1: 'y'}, Python keeps only one pair, 1 : 'y'. The second pair replaces the first.
So two elements can never share a key, and (B) is true.

Step 4: Check the data type group:
Sequence types are string, list and tuple. They support indexing by position. A dictionary is a mapping type, so (A) is false.

Final Answer:
Option (B) is the only true statement.
Was this answer helpful?
0