Q.Given the following Tuple Tup=(10, 20, 30, 50) Which of the following statements will result in an error?
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):
-
print(Tup[0])— IndexingThis 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 prints10. -
Tup.insert(2, 3)— Attempted insertionThe
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.
-
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.