
Python InstitutePCAP - Certified Associate Python Programmer
Domain 3Objective 3
PCAP-31-03 3.3 Employ Built-In String Methods PCAP-31 Practice Questions (Page 11)
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 51–55
- 51
You are parsing a configuration string: 'host=server1;port=8080;host=server2'. You need to find the position of the second occurrence of 'host' to extract the second hostname. Which approach correctly finds that position?
Select an answer first - 52
A validation function must check if a user's email address contains the '@' symbol. If it does not, the function should return a friendly error message instead of raising an exception. Which code snippet is most appropriate?
Select an answer first - 53
You have a file path: '/home/user/docs/report.pdf'. You need to extract the file extension (the substring after the last dot). Which method is most appropriate to find the position of that dot?
Select an answer first - 54
You have a string 'Python'. You need to create a new string that contains the characters of the original string sorted in descending alphabetical order. Which expression produces the desired result?
Select an answer first - 55
A form validator must ensure that a username contains only letters and digits (no spaces or special characters). The input may have leading/trailing spaces. Which condition correctly validates the username?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
No more pagesBack to PCAP-31
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.