🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Tuples and Sets: all 15 questions

Quiz: Tuples and Sets · Question 4 of 15

What happens here? (code)

What happens here?

t = (1, 2, 3)
t[0] = 10
  1. A.t becomes (10, 2, 3)
  2. B.TypeError
  3. C.t becomes (10, 1, 2, 3)
  4. D.Nothing happens
Answer & explanation

Correct answer: TypeError

Tuples are immutable, so assigning to an index raises a TypeError.

Can you get the rest right without peeking?

Take the timed Quiz: Tuples and Sets quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →