PCEP String Operations and Methods Flashcards
6 cards from real PCEP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 PCEP String Operations and Methods flashcards as text
What is the output of `'Python'[1:4]`?
Answer: yth
Slicing `[1:4]` extracts characters at indices 1, 2, and 3, giving 'yth'.
Which string method returns `True` if all characters in the string are alphabetic?
Answer: isalpha()
`isalpha()` returns `True` only when every character in the string is a letter.
What does `'hello'.upper()` return?
Answer: HELLO
The `upper()` method converts all characters in the string to uppercase.
What is the result of `' hello '.strip()`?
Answer: hello
`strip()` removes leading and trailing whitespace from a string.
Which operator is used to repeat a string in Python?
Answer: *
The `*` operator repeats a string a given number of times, e.g., `'ab' * 3` gives `'ababab'`.
What does `'apple,banana,cherry'.split(',')` return?
Answer: ['apple', 'banana', 'cherry']
`split(',')` breaks the string at each comma and returns a list of the resulting substrings.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- pythoninstitute.org — Fees, exam format, passing score, retake fee, score release, time limit, score validity, test delivery, eligibility, retake policy · verified Oct 2026