PCEP Computer Programming and Python Fundamentals Practice Question
Which TWO of the following are immutable data types in Python?
⚠ Common exam trap
The PCEP exam often tests the distinction between mutable and immutable types by pairing tuple (immutable) with list (mutable), hoping candidates confuse tuple's immutability with list's mutability, or mistakenly think that because a tuple can contain mutable objects, the tuple itself is mutable.
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
✓
str
Strings (str) in Python are immutable, meaning once a string object is created, its content cannot be changed. Any operation that appears to modify a string actually creates a new string object in memory, leaving the original unchanged.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
str
Why this is correct
Immutable: string objects cannot be changed.
- ✗
set
Why it's wrong here
Mutable: can add/remove elements.
- ✗
dict
Why it's wrong here
Mutable: can add/remove keys.
- ✗
list
Why it's wrong here
Mutable: can change elements.
- ✓
tuple
Why this is correct
Immutable: cannot change after creation.
Go deeper
Related to this question
About these practice questions
One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on PCEP
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which THREE of the following are immutable data types in Python?
medium- ✓ A.str
- ✓ B.int
- ✓ C.float
- D.list
- E.dict
Why A: Strings (str) in Python are immutable, meaning once a string object is created, its content cannot be changed. Any operation that appears to modify a string actually creates a new string object in memory, leaving the original unchanged.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.