ProgrammingVery hardGATE CS · Product-company placement

Assertion (A): After `t = (1, 2, [3])`, the statement `t[2].append(4)` succeeds and changes what `print(t)` shows. Reason (R): A tuple's immutability means the references it holds cannot be rebound, not that the objects they refer to cannot change.

  1. A. Both A and R are true, but R is not the correct explanation of A
  2. B. A is true but R is false
  3. C. Both A and R are true, and R is the correct explanation of A
  4. D. A is false but R is true

Correct answer: C. Both A and R are true, and R is the correct explanation of A

t[2] is a list; appending mutates the list object while the tuple still holds the same reference, so print shows (1, 2, [3, 4]). That is exactly the distinction R draws.

More Python Programming questions

Exams that ask this topic