Skip to content
Question 37 of 97

Q.What will be the output of the following code snippet ? t = tuple('tuple') t2 = t[2], t += t2 print(t) (A) ('tuple') (B) ('tuple','p') (C) ('t', 'u', 'p', 'l', 'e', 'p') (D) ('t', 'u', 'p', 'l', 'e')

Sikkim CbseCBSE Class XII Board 2026MCQ· 1mImportance★★★★★
38% · 37/97 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

tuple('tuple') splits the string into five single-character elements; t2 = t[2], (note the trailing comma) packs ('p',); t += t2 concatenates, giving ('t', 'u', 'p', 'l', 'e', 'p') — option (C).

Concept — two tuple facts this question tests

  1. tuple() on a string iterates character by character. tuple('tuple') is ('t','u','p','l','e'), never ('tuple',). To get a one-element tuple holding the whole word you would write ('tuple',) explicitly.
  2. A trailing comma packs a tuple. t2 = t[2], is tuple packing: it is the same as t2 = (t[2],). And t += t2 on a tuple builds a new tuple equal to t + t2 (tuples are immutable, so += rebinds t to the concatenation).

Step-by-step trace

t = tuple('tuple')
t2 = t[2],
t += t2
print(t)
StepStatementWhat happenstt2
1t = tuple('tuple')the string is iterated char by char('t','u','p','l','e')—
2t2 = t[2],t[2] is 'p'; the comma packs it into a tuple('t','u','p','l','e')('p',)
3t += t2concatenation: t + ('p',) rebinds t('t','u','p','l','e','p')('p',)
4print(t)prints the six-element tuple——

Expected output:

('t', 'u', 'p', 'l', 'e', 'p')
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.