Skip to content
Question 59 of 97

Q.Given the following Tuple Tup=(10, 20, 30, 50) Which of the following statements will result in an error?

(a) print(Tup[0])
(b) Tup.insert(2,3)
(c) print(Tup[1:2])
(d) print(len(Tup))
Yanam BieapCBSE Class XII Board 2023MCQ· 1mImportance★★★★★
61% · 59/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 →

Tuples in Python are immutable — they cannot be modified after creation. The statement Tup.insert(2,3) attempts to insert an element, which will raise an AttributeError because tuples have no insert() method. The answer is (b).

Tuples are one of Python's fundamental sequence types, alongside lists. The critical difference: tuples are immutable. Once you create a tuple, you cannot add, remove, or change its elements. Lists, on the other hand, are mutable and support methods like append(), insert(), remove(), and so on. This is a favourite trap in CBSE Class 12 Computer Science MCQs.

This immutability means tuples support only operations that read or access data — indexing, slicing, length calculation — but reject any operation that would modify the structure.

Let's examine each statement against the tuple Tup = (10, 20, 30, 50):

  1. print(Tup[0]) — Indexing

    This accesses the element at index 0, which is 10. Indexing is a read-only operation; it doesn't modify the tuple. This works perfectly and prints 10.

  2. Tup.insert(2, 3) — Attempted insertion

    The insert() method is a list method that adds an element at a specified position. Tuples do not have this method because insertion would modify the tuple, violating immutability. Python raises:

    AttributeError: 'tuple' object has no attribute 'insert'
    

    This statement results in an error.

  3. print(Tup[1:2]) — Slicing …

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.