Courseiva
Data Types, Variables, Basic I/O and OperatorseasyMultiple SelectObjective-mapped

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

Which TWO data types are immutable in Python?

⚠ Common exam trap

The PCEP exam often tests the misconception that 'immutable' means the variable cannot be reassigned, but immutability refers to the object itself, not the variable binding; candidates may incorrectly think lists or dicts are immutable because they can reassign the variable.

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) are immutable in Python, 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. Option E is correct because integers (int) are also immutable; when you perform arithmetic on an integer, a new integer object is created rather than modifying the original.

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. Strings cannot be modified in-place.

  • set

    Why it's wrong here

    Mutable. Sets can be modified.

  • list

    Why it's wrong here

    Mutable. Lists can be changed.

  • dict

    Why it's wrong here

    Mutable. Dictionaries can be changed.

  • int

    Why this is correct

    Immutable. Integers are immutable.

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 →

How Courseiva writes practice questions · Editorial policy

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 of the following is an immutable data type in Python?

easy
  • A.tuple
  • B.set
  • C.list
  • D.dict

Why A: A tuple is immutable because once created, its elements cannot be changed, added, or removed. This is enforced by Python's internal structure: tuples are stored as a fixed-length array of object references, and no methods exist to modify them in place.

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.