Question 61 markMCQSection A

What will be the output of the following code snippet ?

``python

t = tuple('tuple')

t2 = t[2],

t += t2

print(t)

``

Review of Python Basics (Class XI Recap)
Tuples — Indexing and Concatenation

Options

(A)('tuple')
(B)('tuple','p')
(C)('t', 'u', 'p', 'l', 'e', 'p')
(D)('t', 'u', 'p', 'l', 'e')

Official answer

Option C — ('t', 'u', 'p', 'l', 'e', 'p') is correct: the original tuple formed from the string 'tuple' has its 3rd element ('p') extracted, wrapped in a single-element tuple, and concatenated back onto the original tuple.

Answer keywords:tuple()tuple concatenationtrailing comma tupletuple indexingPython tuplessequence to tuple conversion

Marking scheme

  1. 1.1 mark: for correctly selecting option C.

Hint

A trailing comma after a value creates a single-element tuple — `t[2],` is a tuple `('p',)`, not the string `'p'`.

Quick oral answer

tuple('tuple') gives ('t','u','p','l','e'); t[2], with the trailing comma creates the 1-element tuple ('p',); concatenating gives ('t','u','p','l','e','p').

Common mistakes

  1. 1.Missing the trailing comma in `t[2],` and assuming t2 is just the character 'p' rather than a 1-element tuple.
  2. 2.Forgetting that tuple() applied to a string splits it into individual characters, not treating the whole string as one element.

Analysis and explanation

This question tests two combined tuple concepts: converting a string to a tuple, and the 'trailing comma' trick for creating a single-element tuple.


Concept / trace

  • t = tuple('tuple') converts the string into a tuple of its characters: ('t', 'u', 'p', 'l', 'e').
  • t2 = t[2], — note the trailing comma after t[2]. t[2] is 'p' (0-indexed: t(0), u(1), p(2), l(3), e(4)); the trailing comma makes t2 a 1-element tuple: ('p',), NOT just the string 'p'.
  • t += t2 concatenates the two tuples: ('t','u','p','l','e') + ('p',) = ('t', 'u', 'p', 'l', 'e', 'p').
  • print(t) displays this final 6-element tuple.

Why other options are wrong

  • Option A (('tuple')) — this is not a valid trace of the code's logic; ('tuple') without a comma is just the string 'tuple' in parentheses, not a tuple.
  • Option B (('tuple','p')) — wrongly treats t as if it were never converted into individual characters, merging it as one item plus 'p'.
  • Option D (('t', 'u', 'p', 'l', 'e')) — this is the tuple BEFORE concatenation with t2; it ignores the t += t2 step entirely.

Exam trap

  • The single trailing comma in t[2], is easy to miss but is essential — without it, t2 would just be the string 'p', and t += t2 would raise a TypeError (cannot concatenate tuple with str) rather than work as shown.

Interesting facts

A single-element tuple MUST have a trailing comma — (5) is just the integer 5 in parentheses, but (5,) is a genuine tuple.

Tuples support the += operator for concatenation just like lists, but unlike lists, this creates a brand-new tuple object each time since tuples are immutable.

Question details

Q6 of 48 questions

Board
CBSE
Class
Class 12
Subject
Computer Science
Year
2026
Section
Section A
Marks
1
Type
MCQ
Chapter
Review of Python Basics (Class XI Recap)
Topic
Tuples — Indexing and Concatenation
Bloom's level
apply
Syllabus topic
Unit 1: Computational Thinking and Programming – 2 — Tuples: Creation, Indexing, and Concatenation
Author
CBSE
Reviewed by
Padhantu Academic Team

Spotted a mistake or something unclear?

Tell us and we will fix it.

Frequently asked questions

Why does a trailing comma matter when creating a tuple?

In Python, it is the comma — not the parentheses — that actually defines a tuple. `(value,)` with a trailing comma creates a genuine 1-element tuple, while `(value)` without a comma is just the value itself inside parentheses.

What does tuple('tuple') return?

It converts the string into a tuple of its individual characters: ('t', 'u', 'p', 'l', 'e'), since strings are iterable sequences of characters.