PCAP Strings Practice Question
Which TWO of the following string methods modify the string in place? (Note: Python strings are immutable.)
⚠ Common exam trap
The question is designed to test the understanding that strings are immutable. The trap is that candidates may incorrectly believe that methods like replace() or strip() modify the string in place, but in fact no string method modifies the original 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
✓
str.lower()
None of the listed string methods modify the string in place because Python strings are immutable. All string methods return a new string rather than altering the original. Therefore, there are no correct options for this 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.
- ✗
str.join()
Why it's wrong here
str.join() returns a new string that is the concatenation of an iterable's elements, joined by the separator string; it does not modify any string in place.
- ✓
str.lower()
Why this is correct
str.lower() returns a new string with all characters lowercased; the original string remains unchanged.
- ✓
str.upper()
Why this is correct
str.upper() returns a new string with all characters uppercased; the original string remains unchanged.
- ✗
str.replace()
Why it's wrong here
str.replace() returns a new string with occurrences of a substring replaced; it does not modify the original.
- ✗
str.strip()
Why it's wrong here
str.strip() returns a new string with leading and trailing characters removed; it does not modify the original.
Go deeper
Related to this question
About these practice questions
This PCAP question is part of Courseiva's 169-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.