PCEP Control Flow, Loops, Lists and Logic Practice Question
Which list method modifies the list in place by adding all elements of another iterable to the end?
⚠ Common exam trap
Python Institute often tests the distinction between `append()` and `extend()` — the trap is that candidates confuse adding an iterable as a single element (append) with adding its individual elements (extend), especially when the iterable is a list or string.
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
✓
extend()
The `extend()` method modifies the list in place by appending all elements from the provided iterable (e.g., another list, tuple, or string) to the end. It does not return a new list; it mutates the original list directly, which is the behavior described in the question.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
+ operator
Why it's wrong here
The + operator returns a new concatenated list, leaving both operands unchanged, so it cannot satisfy an in-place requirement. It is tempting because it does append elements, and it would be correct where a fresh combined list is wanted rather than mutating the original.
- ✗
insert()
Why it's wrong here
insert() places one object at a specified index, shifting existing elements; it does not consume an iterable and append its members. It is tempting because it also modifies in place, but the method that adds every element of another iterable to the end is extend().
- ✗
append()
Why it's wrong here
append() adds a single object as one element at the end, so passing an iterable nests it rather than extending the list. It is tempting because it also modifies in place, but the method that adds each element of another iterable individually is extend().
- ✓
extend()
Why this is correct
extend() appends every element from an iterable individually to the existing list, mutating it in place and returning None. append() adds the iterable as one nested object, while + and slicing create new lists, so extend() uniquely satisfies the in-place, element-wise requirement.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 482-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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 two of the following list methods modify the original list in place? (Choose two.)
easy- ✓ A.sort()
- B.count()
- C.sorted()
- ✓ D.append()
- E.copy()
Why A: Option A, sort(), is correct because it is a list method that reorders the list's elements directly in the existing list object and returns None, so the original list is modified in place. Option D, append(), is correct because it adds a single element to the end of the existing list object and also returns None, mutating the original list. Option B, count(), is not correct because it only returns the number of occurrences of a value and does not change the list. Option C, sorted(), is not correct because it is a built-in function that returns a new sorted list, leaving the original list unchanged. Option E, copy(), is not correct because it returns a shallow copy of the list without modifying the original list.
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.