
Python InstitutePCAP - Certified Associate Python Programmer
Domain 3Objective 3
PCAP-31-03 3.3 Employ Built-In String Methods PCAP-31 Practice Questions (Page 6)
Part of the Strings domain, which accounts for 18% of the PCAP-31 exam. Python Institute does not publish an official question count, but from its 65-minute exam (~25–45 total, ~5–8 in this domain), expect 2–3 from this objective — we provide 55 practice questions to prepare you well beyond it. (estimate)
55questions here
11free pages
8concepts
18%of the exam
Questions 26–30
- 26
A parser must split a string on the first occurrence of a delimiter, but only if the delimiter is present. If the delimiter is absent, the entire string should be returned as a single-element list. Which code snippets correctly implement this? (Select all that apply.)
Select an answer first - 27
A data validation function must check that a username contains only letters and digits, and that it does not contain the substring 'admin' anywhere. Which condition correctly implements this?
Select an answer first - 28
A list of strings contains a mix of uppercase and lowercase words. The requirement is to sort the list so that all words starting with a digit come first, then the rest in alphabetical order (case-insensitive). Which code achieves this?
Select an answer first - 29
A configuration file has lines like ' port=8080 ' with extra spaces around the key-value pair. A script must extract the value '8080' and ensure no surrounding whitespace. Which code snippets correctly accomplish this? (Select all that apply.)
Select an answer first - 30
A file path string is 'C:/Users/John/Documents/report.txt'. A script needs to find the position of the last slash to extract the filename. Which method should be used?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Python Institute. “PCAP-31” is a trademark of its owner, used for identification only.