PCAP Strings Practice Question
Which TWO of the following operations can be performed on a string?
⚠ Common exam trap
Python Institute often tests the distinction between mutable (list) and immutable (string) types, leading candidates to incorrectly assume that list methods like `.append()`, `.extend()`, and `.pop()` also work on strings.
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
✓
Slicing with [::]
String slicing with the syntax `[start:stop:step]` (e.g., `[::]`) is a built-in operation for strings in Python, allowing extraction of substrings. Option E is correct because the `+` operator performs string concatenation, creating a new string by joining two strings together.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Extend with .extend()
Why it's wrong here
The .extend() method belongs to the built-in list type, not to str; it iterates over an argument and appends each element in place, modifying the list. Since strings are immutable sequences, they have no extend() method and cannot be modified in place at all. Attempting to call my_string.extend(...) raises AttributeError, because the method does not exist on str objects.
- ✗
Append with .append()
Why it's wrong here
The .append() method is defined only for mutable sequence types like list (and similar), adding exactly one element to the end and returning None. A str is internally a fixed, immutable sequence of Unicode characters, so it exposes no append() method; trying to alter an existing string this way produces an AttributeError. Immutability means every string operation must create a new object rather than mutate the original.
- ✗
Pop with .pop()
Why it's wrong here
The pop() method is implemented for list (removing by index) and dict (removing by key), both of which are mutable containers that can shrink in place. Strings, however, are immutable, so they do not support removing characters from the existing object, and str has no pop() method whatsoever. Any attempt to pop from a string will raise AttributeError, and there is no way to destructively modify a string anyway.
- ✓
Slicing with [::]
Why this is correct
Slicing with [::] is a valid, non-mutating operation on strings because str implements the sequence protocol via __getitem__, accepting a slice object. For example, s[::-1] creates a reversed copy of the string, while s[1:4] extracts a substring; in every case the result is always a brand-new string and the original is left unchanged. This works regardless of the immutability of strings because it reads data rather than trying to modify it.
- ✓
Concatenation with +
Why this is correct
Concatenation with the + operator is another string operation that respects immutability: it creates a new str object containing the characters of the left operand followed by the characters of the right operand. Under the hood, this uses __add__ (or __concat__) and does not alter either input string, making it safe to use with immutable types like str. This is why expressions like 'ab' + 'cd' produce a new string 'abcd' rather than mutating one argument.
Go deeper
Related to this question
About these practice questions
This PCAP question is part of Courseiva's 421-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PCAP 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 PCAP exam.