
Python InstitutePCAP - Certified Associate Python Programmer
Domain 3Objective 3
PCAP-31-03 3.3 Employ Built-In String Methods PCAP-31 Practice Questions (Page 8)
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 36–40
- 36
A data-cleaning script receives user input that may contain leading/trailing spaces and digits. You need to verify that after stripping, the remaining text consists only of letters (no digits, no spaces) before storing it. Which code snippet correctly performs this check?
Select an answer first - 37
You have a list of IP addresses: ips = ['192.168.1.1', '10.0.0.1', '172.16.0.1']. You need to produce a single string with the IPs sorted by their last octet (the number after the last dot) and separated by a semicolon. Which code snippet achieves this?
Select an answer first - 38
A CSV line is: 'name,age,city'. You need to parse it into a list of fields, but you also need to handle the possibility that a field may contain a comma (e.g., 'Doe, John'). Which approach is most robust?
Select an answer first - 39
You are processing a list of strings that may have leading/trailing whitespace and also may contain internal spaces. You need to remove only the leading/trailing whitespace, not the internal spaces, and then check if the resulting string is non-empty. Which code snippet does this?
Select an answer first - 40
You are writing a parser that must locate the position of the first '=' in a string, but you want to avoid raising an exception if '=' is not present. You also need to find the last '=' if there are multiple. Which combination of methods is most appropriate?
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.