CBSE Class 12 Computer Science Question 5 of 105

Python Revision Tour II — Question 5

Back to all questions
5
Question

Question 5

Assertion. Dictionaries are mutable but their keys are immutable.

Reason. The values of a dictionary can change but keys of dictionary cannot be changed because through them data is hashed.

Answer

(a)

Both Assertion and Reason are true and Reason is the correct explanation of Assertion.

Explanation
A dictionary is a unordered set of key : value pairs and are indexed by keys. The values of a dictionary can change but keys of dictionary cannot be changed because through them data is hashed. Hence dictionaries are mutable but keys are immutable and unique.