Courseiva
Computer Programming and Python FundamentalshardMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Given the code: a = [1, 2, 3]; b = a; b.append(4). What is the value of a?

⚠ Common exam trap

The trap here is that Cisco tests whether candidates understand that assignment with `=` does not create a new copy for mutable objects; many mistakenly think `b = a` creates a separate list, leading them to choose option C.

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

[1, 2, 3, 4]

In Python, variables hold references to objects, not copies. When `b = a` is executed, both `a` and `b` point to the same list object in memory. The `append()` method modifies the list in-place, so the change is visible through both references. Thus, `a` becomes `[1, 2, 3, 4]`.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • [1, 2, 3, 4]

    Why this is correct

    Both a and b refer to the same list.

  • Error

    Why it's wrong here

    No error.

  • [1, 2, 3]

    Why it's wrong here

    b is not a copy; it's a reference.

  • [1, 2, 3, [4]]

    Why it's wrong here

    append adds element, not nested list.

About these practice questions

Courseiva writes every PCEP question from scratch — 498 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.