Test Index

CBSE Class 12 Computer Science 2025 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 20 of 37
Marks: +1, -0
Assertion (A) : Every object in Python is assigned a unique identity (ID).
Reason (R) : ID remains the same for the lifetime of that object.
Solution:  
Explanation:
Assertion: when an object is created, Python gives it an identity, an integer returned by id(). No two objects that exist at the same time have the same ID. A is true.
>>> x = [1, 2]
>>> y = [1, 2]
>>> id(x) == id(y)
False
Reason: the ID of an object never changes while the object exists, even if its contents change (e.g. after x.append(3), id(x) is the same). R is true.
But R does not explain A: R says the ID is constant over time, while A says each object's ID is different from every other object's. The fact that an ID does not change is not the reason it is unique.
Key point: Both statements are separate properties of identity (uniqueness and permanence), so the answer is (B), not (A).
Answer:
Option B (Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of the Assertion (A).)
© examsnet.com
Advertisements
Go to Question: