Courseiva

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

Which TWO of the following Python data types are mutable?

⚠ Common exam trap

Python Institute often tests the misconception that strings or tuples are mutable because they support indexing and slicing, but candidates must remember that these operations return new objects rather than modifying the original.

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

✓

list

Option A (list) is correct because Python lists are mutable sequence types: you can change, add, or remove elements in place (e.g., append(), item assignment) without creating a new object. Option E (dict) is correct because dictionaries are mutable mappings: key-value pairs can be added, updated, or deleted in place (e.g., d['k'] = v, del d['k']). The unmarked options are immutable: str (B) cannot be modified in place since strings are immutable sequences, tuple (C) is an immutable sequence whose contents cannot be reassigned, and int (D) is an immutable numeric type where any arithmetic produces a new object 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.

  • ✓

    list

    Why this is correct

    Lists are mutable because their elements can be reassigned, appended or removed in place after creation, with the same object identity retained. This satisfies the stem's requirement for mutability, unlike tuples or strings, which return new objects on modification.

  • ✗

    str

    Why it's wrong here

    Strings are immutable: any operation that appears to modify one returns a new str object, leaving the original unchanged. The mutable built-in sequence types are list, dict and set. str would be the correct answer only if the question asked which types are immutable.

  • ✗

    tuple

    Why it's wrong here

    Tuples are immutable: once created, their elements cannot be reassigned, so they cannot satisfy a question asking for mutable types. They are tempting because they hold ordered collections like lists, and would be correct where a hashable, unchangeable sequence is required, such as a dictionary key.

  • ✗

    int

    Why it's wrong here

    Integers are immutable: any arithmetic operation returns a new int object rather than altering the existing one, so int cannot satisfy a mutability question. They tempt because they are the default numeric type, and would be the right answer where an unchangeable numeric constant or dictionary key is needed.

  • ✓

    dict

    Why this is correct

    Dictionaries are mutable: their key-value pairs can be added, removed or reassigned in place after creation without producing a new object. This contrasts with tuples and strings, which are immutable, so dict satisfies the question's requirement alongside the other mutable type.

About these practice questions

One of 482 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

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.