
Python InstitutePCAP - Certified Associate Python Programmer
Domain 3Objective 3
PCAP-31-03 3.3 Employ Built-In String Methods PCAP-31 Practice Questions (Page 5)
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 21–25
- 21
A log file contains lines like 'INFO: user logged in '. A script must extract the message after the colon, remove extra spaces from both ends, and then split it into words. Which code correctly handles this?
Select an answer first - 22
A security script must verify that a user-supplied token contains only alphanumeric characters, has a length of at least 8, and does not contain the word 'admin' in any case. Which condition correctly implements all requirements?
Select an answer first - 23
A data cleaning function must remove all leading and trailing whitespace from a string, but also remove any leading/trailing occurrences of the character '#' after whitespace is removed. Which sequence of operations is correct?
Select an answer first - 24
A developer must create a comma-separated string from a list of mixed-type items, but only include items that are strings consisting solely of letters. Which code achieves this?
Select an answer first - 25
A function must find the last occurrence of a substring in a string, but if the substring is not found, it should return -1. 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.