Free · No account needed · No credit card

Certified Associate Python Programmer PCAP Practice Test

511 questions with instant explanations, domain breakdown, and wrong-answer analysis. Built for the real exam.

Instant feedback after each answer
Full explanations included
Domain score breakdown
Real exam: 65 min
Pass mark: 700%

Sample questions with explanations

This is exactly what you see during practice — question, options, and a full explanation after you answer.

Q1Modules and Packagesmedium
Full explanation →

A developer is working on a project that requires the use of a third-party package hosted on a private repository. The developer wants to ensure that the package can be imported without specifying the full repository URL each time. Which approach should be taken?

AAppend the repository path to sys.path in the script.
BPlace the package files in the site-packages directory manually.
Configure the repository URL in pip's configuration file or in requirements.txt.Correct
DUse os.system to run a pip install command from within the script.

Option C is correct because configuring the repository URL in pip's configuration file (e.g., `pip.conf`, `pip.ini`, or `~/.config/pip/pip.conf`) or in `requirements.txt` using the `--index-url` or `--extra-index-url` option allows pip to resolve the package from the private repo…Read full explanation

Q2Modules and Packageseasy
Full explanation →

A Python script imports the module 'my_module'. The developer wants to ensure that when the script is run directly, it executes a specific function, but when imported as a module, that function is not executed. Which code snippet achieves this?

Aif __name__ == '__main__': run()
if __name__ == '__main__': run()Correct
Cif os.environ.get('RUN_MAIN'): run()
Dif sys.argv[0] == 'my_module': run()

Option B is correct because the `if __name__ == '__main__':` guard is the standard Python idiom to check whether a script is being run directly (as the main program) or being imported as a module. When the script is executed directly, Python sets the special variable `__name__` t…Read full explanation

Q3Modules and Packageshard
Full explanation →

A developer creates a package named 'analytics' with the following structure: analytics/ __init__.py stats.py models/ __init__.py regression.py The developer wants the statement 'from analytics import *' to import only the functions 'mean' and 'std' from stats.py. What should be added to analytics/__init__.py?

ANothing; by default, all names are exported.
Bfrom analytics.stats import *
C__all__ = ['stats.mean', 'stats.std']
__all__ = ['mean', 'std']Correct

Option D is correct because in Python, the `__all__` variable in a package's `__init__.py` explicitly controls which names are exported when `from package import *` is used. By setting `__all__ = ['mean', 'std']`, the developer ensures that only the functions `mean` and `std` fro…Read full explanation

Untimed Practice

Answer at your own pace. Explanation and domain tag shown immediately after each answer.

Timed Practice

Countdown timer starts immediately. Results and domain scores shown at the end — just like the real exam.

Why practice here?

Full explanations on every question

Not just the right answer — you get exactly why each wrong option is wrong, so you learn the concept, not the answer.

Domain score breakdown

After each session see your score by exam domain so you know exactly where to focus study time.

100% free, forever

No subscription, no trial, no email wall. Start a session in under 10 seconds.

Exam-style questions

Scenario-based, precise wording, realistic distractors — written to match what you actually see on exam day.

← All PCAP questionsPCAP exam guideStudy guidePractice by domain