2026 Actual Python Institute PCAP-31-03 Dumps, Updated Exam Questions for Guaranteed Pass

Certified Associate in Python Programming Exam - Free Practice Questions with Explanations, Exam Dumps, and Complete Practice Pack from DumpsProvider.

Exam Information

VendorPython Institute
Exam codePCAP-31-03
Exam nameCertified Associate in Python Programming Exam
Questions in pack154
Last updatedNovember 22, 2026
Related certificationsCertified Associate in Python Programming

Free practice questions with explanations

Python Institute PCAP-31-03 Practice Questions

Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.

Questions
15
Answered
0
Correct
0
Score
-
  1. 1 Question 1 Single choice Modules and Packages

    A developer maintains a utility package named billing with the layout billing/__init__.py, billing/invoices/__init__.py, and billing/invoices/render.py. A script in the project root runs import billing.invoices.render and then calls billing.invoices.render.to_pdf(). The call raises AttributeError, yet a colleague confirms that to_pdf is defined in render.py. The script's top-level code contains no other imports. Which change is the MOST appropriate fix without restructuring the package?

  2. 2 Question 2 Order list Exceptions

    A data-import routine reads records from a file and must release the file handle even when a record is malformed, while still reporting a custom error that carries the offending line number. The team wants a single, safe sequence of steps to implement this behaviour in Python 3. Arrange the steps in the order they must be performed.

    Drag the steps into the correct order, or use the arrows.

    1. Open the file inside a try block and iterate over its lines
    2. Define a custom exception class that inherits from ValueError and stores the line number in an attribute
    3. Call close on the file object in a finally clause so the handle is always released
    4. Raise an instance of the custom exception with the malformed line number when parsing fails
    5. Catch the custom exception in an outer handler and bind it with as to log its arg value
  3. 3 Question 3 Single choice Strings

    A logging service receives user-supplied display names encoded as UTF-8 bytes. A developer needs to produce a Python str from the bytes, then compute the number of code points in the result and extract the first character so it can be shown in a compact preview. The service must not raise errors on the byte sequence b'Zo\xc3\xab' and must not lose characters. Which sequence of operations is correct?

  4. 4 Question 4 Multiple choice Object-Oriented Programming

    A team maintains a class hierarchy in which class Base defines a method describe. Class Left inherits from Base and overrides describe, and class Right inherits from Base and does not override it. Class Diamond inherits from both Left and Right, in that order. A developer wants Diamond instances to resolve describe through the MRO without ambiguity and wants to verify the resolution order at runtime. Which TWO statements are correct? (Choose two.)

  5. 5 Question 5 Dropdown Miscellaneous (List Comprehensions, Lambdas, Closures, and I/O Operations)

    A log-cleaning script must read a text file line by line, keep only lines that contain the word ERROR, and write them to a new file. The team wants the output file opened in a mode that creates or truncates it and writes text, and the input to be read as a sequence of lines without loading the whole file. Complete the statement by selecting the correct value for each blank.

    Choose the correct value for each blank.

    with open('app.log', 'r') as src, open('errors.txt', ) as dst:
    dst.writelines(line for line in src if in line)
  6. 6 Question 6 Single choice Modules and Packages

    A data-science team deploys a scheduled job on a shared host. The job must choose a random sample of exactly 50 records from a list of 10,000 and must produce the same sample on every run so that audit reconciliation is reproducible. The developer currently calls random.choice fifty times, which sometimes returns duplicates, and the job is run from a fresh interpreter each time. Which change satisfies every requirement?

  7. 7 Question 7 Drag and drop Strings

    A text-processing service receives CSV-like lines from a legacy system and must normalise them before storage. The service must remove surrounding whitespace, test whether a field is entirely made of digits, produce an alphabetically ordered list of tokens without changing the original list, and locate the position of a delimiter from the right side of a string. Match each requirement to the string method or function that meets it.

    Drag each item onto its matching target. On a phone: tap an item, then tap a target.

    Determine whether every character of a field is a decimal digit
    Produce a new alphabetically ordered list of tokens while leaving the original list unchanged
    Find the highest index of a delimiter, searching from the end of the string
    Split a comma-separated line into a list of fields
    .split()
    .rfind()
    .sort()
    sorted()
    .isdigit()
    .index()
  8. 8 Question 8 Single choice Exceptions

    A payment module wraps a third-party client whose network calls can raise either ConnectionError or TimeoutError, both of which are subclasses of OSError. A retry policy must handle both transient failures by retrying, but any other OSError subtype, such as PermissionError, must propagate unchanged so that operations is alerted. The developer also wants the retry handler to read the original message from the exception. Which exception-handling construct is the MOST appropriate?

  9. 9 Question 9 Order list Object-Oriented Programming

    A library author wants a class Sensor that stores a per-class calibration count shared by all instances, keeps a private reading buffer that external code must not access by its plain name, and exposes a read-only property for the current value. A subclass named ThermalSensor should reuse the constructor of its parent before adding its own attribute. Arrange the steps in the order they must be performed when defining these classes.

    Drag the steps into the correct order, or use the arrows.

    1. Define a property method in Sensor that returns the buffer value and has no setter
    2. Declare ThermalSensor as a subclass of Sensor and call super().__init__ from its own __init__
    3. Define __init__ in Sensor that assigns the private buffer attribute using a double-underscore name
    4. Declare the class Sensor with a class-level attribute calibration_count set to zero
    5. Add the thermal-specific instance attribute inside ThermalSensor after the parent initialiser has run
  10. 10 Question 10 Single choice Miscellaneous (List Comprehensions, Lambdas, Closures, and I/O Operations)

    A reporting module needs to produce a function that multiplies values by a rate chosen at configuration time. The rate is read once at startup and must remain fixed for every later call to the returned function, without being passed as an argument each time and without using global state. A developer also needs to apply the resulting function to a list using map and keep only results above a threshold using filter. Which implementation meets these requirements?

  11. 11 Question 11 Multiple choice Exceptions

    A developer is writing a validation routine for a configuration loader. Invalid input must fail the routine loudly, and a defensive check that is compiled out under the optimised interpreter mode must not be the sole guard for a security-critical condition. The developer wants to know which TWO statements about raising and asserting in Python 3 are accurate. (Choose two.)

  12. 12 Question 12 Single choice Modules and Packages

    A monitoring agent must record the host's Python version and CPU architecture in its heartbeat payload, and it must perform a rounding operation on a timing measurement that always rounds toward negative infinity. The agent runs on a fleet with mixed interpreters. The developer chooses platform and math functions. Which combination produces correct results for both requirements?

  13. 13 Question 13 Dropdown Object-Oriented Programming

    A developer is inspecting a class hierarchy in an interactive session to verify how a plugin framework registers handlers. The framework must confirm that an object supports a method called handle before calling it, must read the module where a class was defined, and must list the direct base classes of a subclass. Complete the statements by selecting the correct value for each blank.

    Choose the correct value for each blank.

    if (plugin, 'handle'):
    print(plugin.__class__.)
    print(Handler.)
  14. 14 Question 14 Single choice Strings

    A compliance tool must generate a report line from a list of product codes in which every code is an uppercase letter followed by digits. The output must be sorted by the numeric portion of each code, not lexicographically, and the list must be rebuilt without mutating the source list that another thread reads concurrently. The tool must also avoid an IndexError when a code is empty. Which implementation meets all of these requirements?

  15. 15 Question 15 Single choice Miscellaneous (List Comprehensions, Lambdas, Closures, and I/O Operations)

    A batch job reads a binary file of unknown size in fixed-size chunks and writes filtered bytes to an output file. The job must avoid loading the whole file, must handle a missing input file by reporting the errno value rather than crashing with a generic message, and must guarantee the output handle is closed even if an error occurs midway. The developer's first draft opens both files without any context manager and calls close only at the end of the happy path. Which change is the MOST appropriate?

These are 15 of the 154 questions in the full PCAP-31-03 pack.

Get All 154 Questions

Get all 154 questions & answers

704 Satisfied customers
94.2% Pass rate feedback
84.3% Said questions matched
97% Found material helpful

Full access options for Python Institute PCAP-31-03

Self-study

PDF Version

$40.00 $20.00
  • 154 actual exam questions
  • Compatible with all devices
  • Printable PDF format
  • No download limits
  • 90 days free updates
  • 24/7 customer support

Exam simulation

Online Practice Test

$50.00 $25.00
  • 154 actual exam questions
  • Actual exam environment
  • 90 days free updates
  • Browser-based software
  • 24/7 customer support

100% Money Back Guarantee

Your success comes first

At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the PCAP-31-03 Exam (Certified Associate in Python Programming Exam) on your very first attempt.

In a rare case, if you fail your exam, we will refund your amount without asking a single question.

100%

Security & Privacy

10000+

Satisfied Customers

24/7

Committed Service

100%

Money Back Guranteed