Courseiva
Control Flow, Loops, Lists and LogichardMultiple SelectObjective-mapped

PCEP Control Flow, Loops, Lists and Logic Practice Question

Which TWO of the following list operations modify the list in place?

⚠ Common exam trap

Python Institute often tests the difference between methods that mutate the list in place (like `sort()` and `append()`) versus operations that return a new list (like concatenation with `+` or `copy()`), trapping candidates who confuse reassignment with in-place modification.

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

mylist.sort()

`mylist.sort()` sorts the list in place, meaning it modifies the original list object without creating a new one. Option E is correct because `mylist.append(5)` adds the element 5 to the end of the list, directly mutating the original list object.

Answer analysis

Option-by-option breakdown

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

  • mylist.sort()

    Why this is correct

    Sorts the list in place.

  • mylist + [5]

    Why it's wrong here

    Returns a new list, original unchanged.

  • mylist.copy()

    Why it's wrong here

    Returns a shallow copy, original unchanged.

  • mylist = mylist + [5]

    Why it's wrong here

    Reassigns mylist to a new list, original is not modified.

  • mylist.append(5)

    Why this is correct

    Modifies the list in place.

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

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.