CBSE Class 12 Computer Science Question 22 of 44

Solved 2025 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 1

Back to all questions
1
Question

Question 22

How is a mutable object different from an immutable object in Python ?

Identify one mutable object and one immutable object from the following:

(1, 2), [1, 2], {1:1, 2:2}, '123'

Answer

In Python, a mutable object can be changed after it is created (e.g., lists, dictionaries), while an immutable object cannot be modified after its creation (e.g., tuples, strings).

An example of a mutable object from the given options is [1, 2] (list) and {1:1, 2:2} (dictionary). [Write any one]

An example of an immutable object from the options is '123' (string) and (1, 2) (tuple). [Write any one]