Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Python Institute logo

Python InstitutePCAP - Certified Associate Python Programmer

Domain 3Objective 3

PCAP-31-03 3.3 Employ Built-In String Methods PCAP-31 Practice Questions (Page 10)

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 46–50

  1. 46expert · hard

    You are parsing a configuration file where each line is in the format 'key = value'. The value may contain spaces, and there may be extra spaces around the '='. You need to extract the key and value, trimming any leading/trailing whitespace. Which code snippet correctly parses the line?

    Select an answer first
  2. 47application · medium

    You have a list of product codes: codes = ['B3', 'A1', 'C2']. You need to produce a single string where the codes are sorted alphabetically and separated by a comma and a space. Which expression achieves this?

    Select an answer first
  3. 48expert · medium

    You have a list of strings that may contain leading/trailing punctuation (e.g., '!hello!', '?world?'). You need to remove only the leading/trailing exclamation marks and question marks, but preserve any other punctuation. Which method call is most appropriate?

    Select an answer first
  4. 49application · medium

    A log line is: 'ERROR: Disk full - retry in 5 minutes'. You need to extract the message after the first colon and then split it into words, but only the first two words are needed. Which code snippet accomplishes this?

    Select an answer first
  5. 50application · medium

    You are cleaning a dataset of usernames that may have extra asterisks (*) at the beginning or end, such as '*alice*'. You need to remove only the asterisks, not any spaces that might be inside the username. Which method call achieves this?

    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.