Test Index
CBSE Class 12 Computer Science 2026 Paper Set 4
© examsnet.com
Question : 6 of 37
Marks:
+1,
-0
What will be the output of the following code snippet ?
t = tuple('tuple')t2 = t[2],t += t2print(t)
Solution:
Explanation:
t = tuple('tuple') → tuple() makes one element from each character: ('t', 'u', 'p', 'l', 'e')t2 = t[2], → t[2] is 'p'; the trailing comma makes a one-element tuple: ('p',)t += t2 → tuple concatenation creates a new tuple ('t', 'u', 'p', 'l', 'e', 'p') and binds it to t.Output:('t', 'u', 'p', 'l', 'e', 'p')Key point: Tuples are immutable, but t += t2 is allowed because it builds a new tuple; the comma (not the brackets) makes t[2], a tuple.Answer:Option C (('t', 'u', 'p', 'l', 'e', 'p'))© examsnet.com
Go to Question: