File I/O and String Operations Flashcards
6 cards from real PCAP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 File I/O and String Operations flashcards as text
Which string method converts all characters to uppercase?
Answer: upper()
`str.upper()` returns a new string with all characters converted to uppercase.
What does `str.strip()` do?
Answer: Removes leading and trailing whitespace
`strip()` removes whitespace (or specified characters) from both ends of the string.
How do you split a string `s` by commas?
Answer: s.split(',')
`str.split(delimiter)` splits the string at each occurrence of the delimiter and returns a list.
Which method joins a list of strings with a separator?
Answer: sep.join(list)
`separator.join(iterable)` concatenates iterable elements using the separator string.
What does the f-string `f'Hello {name}'` do?
Answer: Inserts the value of `name` into the string
f-strings (formatted string literals) evaluate expressions in `{}` and embed them in the string.
Which method checks if a string starts with a given prefix?
Answer: startswith()
`str.startswith(prefix)` returns True if the string starts with the specified prefix.
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 — Eligibility, fees, exam format, passing score, retake fee, retake policy, score release, time limit, score validity, exam information · verified Oct 2026
- home.pearsonvue.com — Test delivery · verified Oct 2026