Question 126 of 498
PCEP Practice Question: Functions, Tuples, Dictionaries and Exceptions
What happens when you try to modify a tuple?
t = (1, 2, 3) t[0] = 0
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
A TypeError is raised
Tuples are immutable, so trying to assign to an index raises a TypeError.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
A TypeError is raised
Why this is correct
Correct; assignment to tuple element raises TypeError.
- ✗
A IndexError is raised
Why it's wrong here
IndexError would be for out-of-range index, but here the operation is assignment which is not allowed.
- ✗
The tuple becomes (0, 2, 3)
Why it's wrong here
Incorrect; tuples cannot be modified.
- ✗
The code runs without error
Why it's wrong here
Incorrect; error occurs.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 24, 2026
This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.