BLACK FRIDAY SALE — 55% OFF sitewide with code BLACKFRIDAY · Ends Dec 15

Free PCAP-31-04 – Certified Associate Python Programmer Practice Test Question

Free demo downloads

Showing 1–10 of 10 questions

Question 1 (Modules and Packages)

What happens the first time a module is imported in a running program?

Select an option, then click Submit answer.

  • ○ The module's top-level code is executed once and the module object is cached in sys.modules
  • ○ The module's code is executed again on every import statement
  • ○ Only the functions are copied into the importer's global namespace
  • ○ The module file is recompiled and deleted after execution

Ask AI for More Explanation

— your own AI account, opens inside the app

About the PCAP-31-04 Free Practice Test

This page holds a free practice test for the Certified Associate Python Programmer (PCAP-31-04) certification from Python Institute. You will find 10 free questions, drawn from the full Study4Pass practice set of 80 questions for this exam. The questions follow the same topic balance as the real exam: Modules and Packages; Exceptions; Strings; Object-Oriented Programming; Advanced Python Constructs and I/O; Testing, Debugging, Collaborative Development, and AI Assistance.

How to use this PCAP-31-04 free practice test

Pick an answer for each question and check it straight away — the correct answer and a full explanation appear under the question. There is no time limit and nothing to sign up for. When an explanation is not enough, use Ask AI: this is an AI-Enabled practice test, and Ask AI explains the concept behind the question in plain language. Ready for more? The full 80-question set adds a timed Exam Simulation mode, topic training for your weak areas, and a flagged-question review.

What to study for each PCAP-31-04 domain

Modules and Packages

Covers importing modules, namespaces and the module search path via sys.path and dir(), creating user-defined modules and regular and nested packages with __init__.py and __pycache__, and managing third-party code with pip, PyPI and requirements.txt.

Key skills

Writing import statements, inspecting modules with dir(), structuring packages, and installing dependencies with pip from PyPI and requirements files.

Exceptions

Covers ordering except handlers, the else and finally clauses, the BaseException and Exception hierarchy including the args attribute, and raising, propagating and re-raising exceptions. It also covers defining custom exception classes for application-specific errors.

Key skills

Handling errors with try/except/else/finally, chaining and re-raising exceptions, and creating and raising custom exception types.

Strings

Covers ASCII, Unicode and UTF-8 encoding with ord() and chr(), string immutability and code-point comparisons, and the is...() validation methods. It also covers searching and inspecting strings with index(), find(), count(), startswith() and endswith(), and ordering characters with sorted().

Key skills

Encoding and decoding text, validating strings with the is...() methods, searching substrings, and comparing and sorting string data.

Object-Oriented Programming

Covers OOP principles, classes, objects, attributes and methods, and the distinction between instance and class variables, including __dict__ and name mangling. It also covers introspection with hasattr() and getattr() and the __name__, __module__ and __bases__ attributes, plus single and multiple inheritance, method resolution order, polymorphism and isinstance() checks.

Key skills

Designing classes with instance and class data, applying inheritance and method overriding, reading an MRO, and introspecting objects at runtime.

Advanced Python Constructs and I/O

Covers list, set and dictionary comprehensions, structural pattern matching with match/case, the loop else clause, lambdas with map() and filter(), and closures. It also covers working with text and binary streams, bytearray, file handling and the pathlib module for path manipulation.

Key skills

Writing comprehensions and pattern-matching code, using lambdas and closures, and reading and writing text and binary files with streams and pathlib.

Testing, Debugging, Collaborative Development, and AI Assistance

Covers writing unit test cases and assertions, reading tracebacks and debugging faulty code. It also covers collaborative development with repositories, branches, code reviews and CI workflows, and using AI assistance responsibly with independent validation and protection of sensitive data.

Key skills

Writing unit tests and assertions, debugging from tracebacks, working with branches, reviews and CI, and validating AI-generated code before use.

PCAP-31-04 practice test — quick questions

Is this PCAP-31-04 practice test free?

Yes — the 10 questions on this page are completely free, with no signup and no payment details needed.

How many questions are in the full PCAP-31-04 set?

80 questions. The 10 free questions above are a sample of that full set, in the same style and topic balance.

Does the free test show the answers?

Yes — every question shows the correct answer with an explanation, and Ask AI can explain the concept behind a question in plain words if you want to go deeper.

Practice Tests Related to PCAP-31-04