Class - 12 CBSE Computer Science — Assertion Reason Type Questions

Assertion. Assigning a new value to an int variable creates a new variable internally.

Reason. The int type is immutable data type of Python.

Python Funda

3 Likes

Answer

(a)

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

Explanation
In python, literal values have fixed memory locations and variable names reference them as values. This means that, although we can change the value of an integer variable, the process involves creating a new integer object with the updated value. Literal values, such as 10, have fixed memory locations, and variables act as references to these values. When we assign a new value to an integer variable, we are essentially creating a new object, and the variable now points to this new object. Hence, both Assertion and Reason are true and Reason is the correct explanation of Assertion.

Answered By

1 Like