dc dotCreds
Python Institute PCAP Practice Test

Python Institute PCAP Practice Test

Start today’s free 10-question Python Institute PCAP set with source-backed explanations, local progress, and a fresh rotation every morning.

10 Free Daily Questions Source-backed Explanations 200 Verified Questions

Questions updated at Aug 26, 2026, 10:47 PM CDT

Go Pro - One Time Unlock

Unlock the full PCAP-31-03 bank

200 verified questions Exam Mode Practice Mode Detailed explanations Weak-area review No subscription - one-time unlock

Get the complete source-backed bank with Interview Questions, the full Study Guide, full Course Notes, detailed explanations, weak-area review, and exam-style practice.

Interview Questions Full Study Guide Full Course Notes Exam Mode Practice Mode Guided Course Detailed explanations Weak-area review No subscription
$4.99 One-time payment
See bundle and PDF options

We will confirm your site email in one quick checkout step.

Why DotCreds?

Practice with explanations that teach.

Source links for every answer Every wrong answer explained Guided Course included Practice and Exam Mode Weak-area tracking Same verified bank across web practice

What you get with free practice

10 Free Questions Daily Fresh set every day from the live bank
Detailed Explanations Learn with clear source-backed answers
Track Your Progress Daily history and performance insights
Upgrade Anytime Unlock the full bank when you are ready
Today's 10 Python Institute PCAP questions

Use this Python Institute PCAP practice test to review Python Institute PCAP Certified Associate Python Programmer. Questions rotate daily and each answer links back to the source used to write it.

Today’s Set
10 questions
Rotates at 10:00 AM local time
Progress
0/10
Answered on this page
Accuracy
0%
Loading countdown…

200 verified questions are in the live bank. Free daily questions are selected from a rotating sample set. Unlock Pro to access the full question bank.

Preparing today’s free questions... Ordering the final locked-bank set before showing the practice cards.
Question 1 of 10
Objective Use the math module 1. Modules and Packages (12%)

A billing rule evaluates ```python import math x = -3.7 print(math.ceil(x), math.floor(x), math.trunc(x)) ``` What is printed?

Concept tested:
Question 2 of 10
Objective Distinguish streams, handles, and modes 5. Miscellaneous - Comprehensions, Lambdas, Closures, and I/O (22%)

A file contains raw image bytes that must not be decoded as text. Which mode should be used to open it for reading?

Concept tested:
Question 3 of 10
Objective Use lambda, map, and filter 5. Miscellaneous - Comprehensions, Lambdas, Closures, and I/O (22%)

A pipeline must convert every input number to its square, then retain only squared values above 10. Which conceptual pairing is correct?

Concept tested:
Question 4 of 10
Objective Operate on strings 3. Strings (18%)

Two separately obtained strings must be compared for the same textual value. Which operator is the correct semantic choice?

Concept tested:
Question 5 of 10
Objective Define and integrate custom exceptions 2. Exceptions (14%)

What escapes `validate()`? ```python class ValidationError(Exception): pass def validate(): try: raise ValidationError("bad") except ValidationError: print("audit") raise ```

Concept tested:
Question 6 of 10
Objective Use instance and class properties 4. Object-Oriented Programming (34%)

What is printed? ```python class Ticket: prefix = "INC" a = Ticket() b = Ticket() print(a.prefix, b.prefix) ```

Concept tested:
Question 7 of 10
Objective Import and qualify modules and packages 1. Modules and Packages (12%)

A utility uses ```python from math import sqrt print(sqrt(81)) ``` Which namespace effect explains why `sqrt(81)` needs no `math.` prefix?

Concept tested:
Question 8 of 10
Objective Use built-in string methods 3. Strings (18%)

What is printed? ```python print("bananana".rfind("na")) ```

Concept tested:
Question 9 of 10
Objective Handle, raise, and inspect built-in exceptions 2. Exceptions (14%)

What happens? ```python def parse(): return int("x") def run(): return parse() try: run() except ValueError: print("caught") ```

Concept tested:
Question 10 of 10
Objective Build inheritance hierarchies 4. Object-Oriented Programming (34%)

What is printed? ```python class Item: def __str__(self): return "ITEM" print(Item()) ```

Concept tested:
Locked preview

You are viewing today’s free 10. Unlock 190 more questions.

Unlock full bank
Daily sample Rotating practice Free daily questions are selected from a rotating sample set.
Pro bank Full access Unlock Pro to access the full question bank, Exam Mode, Practice Mode, and random tests.
PCAP-31-03 Pro $4.99 one-time

Unlock all 200 Python Institute PCAP questions, explanations, review tools, and exam-style practice.

50 Exam Practice Test $1.99 one-time

A 50-question PCAP-31-03 PDF for short review sessions. Questions come first, then the answer review and explanations later in the file.

All Access $6.99/month

Unlock every active practice exam, bundle and path experience, Pro course and study content, and included downloads.

What’s includedEvery current and future active practice exam, All active bundle and career-path practice content, Pro course lessons, study content, and supported paid downloads

Choose an unlock option to continue. We will confirm your site email in one quick checkout step.

Secure checkout powered by Stripe. Source-backed questions. Not brain dumps. Checkout stays on this page and unlocks the same Pro builder on this practice page.

Purchase options

Unlock the full PCAP-31-03 bank.

Get the full bank, Exam Mode, Practice Mode, question sets, random tests, readiness tracking, saved box scores, and review tools for this exam.

The PDF versions keep questions first and move the answer review, explanations, and distractor notes to the back of the file.

200 verified exam-style questions Every choice explained Exam Mode and Practice Mode Question sets and random tests Readiness score and trends Previous test box scores

You've answered 0/10 questions in today's set.

Locked: 190 more questions in the full bank.

Locked: exam simulation mode, practice mode, readiness tracking, and saved review history.

Checkout stays on this page, so you can keep practicing, unlock the full bank, and start Exam Mode or Practice Mode when you are ready.

Cheat Sheets

7-day score keeper

Answer questions today and this will become a rolling 7-day scorecard.

Local history
Optional progress sync

Keep today’s practice moving

Guest progress saves automatically on this device. Add an email later when you want a magic link that keeps your daily PCAP-31-03 practice in sync across browsers.

Guest progress saves on this device automatically

Guest progress is available without an account.

Source-backed answer review

The free daily Python Institute PCAP set includes crawlable question text, answer choices, correct answer labels, objective mapping, and source links. Only the first SEO card includes answer explanations and any extra learning features. Pro-only bank questions stay locked; this section mirrors only the 10 free daily questions already shown on this page.

Question 1 A billing rule evaluates ```python import math x = -3.7 print(math.ceil(x), math.floor(x), math.trunc(x)) ``` What is printed?

Answer choices

  1. A. `-3 -4 -3`
  2. B. `-4 -4 -3`
  3. C. `-3 -3 -4`
  4. D. `-4 -3 -4`

Correct answer

`-3 -4 -3`

`ceil` moves toward positive infinity, `floor` toward negative infinity, and `trunc` removes the fractional part toward zero; each returns an integer here.

Wrong-answer review

  • B. `-4 -4 -3`: Incorrect. This choice would produce different behavior from the code shown.
  • C. `-3 -3 -4`: Incorrect. This choice applies a different Python rule than the one exercised in the scenario.
  • D. `-4 -3 -4`: Incorrect. This choice does not match the behavior required by the code or the documented rule.

Extra learning features

Interview question

Q: How do `math.ceil()`, `math.floor()`, and `math.trunc()` differ for a negative value, and why is saying they all 'round' insufficient? Strong answer: `ceil` moves toward positive infinity, `floor` toward negative infinity, and `trunc` toward zero. For `-3.7`, those results are `-3`, `-4`, and `-3`. The direction matters most when the input is negative.

  • ceil toward +infinity
  • floor toward -infinity
  • trunc toward zero
  • negative-number behavior

Caution: Listen for the direction of each operation, not vague language such as 'round up' without explaining negative values.

Why this matters

This matters because PCAP expects you to apply the exact Python rule, not a keyword association: `ceil` moves toward positive infinity, `floor` toward negative infinity, and `trunc` removes the fractional part toward zero; each returns an integer here. In real programs, misunderstanding this behavior can choose the wrong numerical result or return type, especially around negative rounding and function-specific behavior.

Objective/domain: 1. Modules and Packages (12%)

Source: Python Standard Library — math

Question 2 A file contains raw image bytes that must not be decoded as text. Which mode should be used to open it for reading?

Answer choices

  1. A. `'r'`
  2. B. `'rt'`
  3. C. `'rb'`
  4. D. `'w'`

Correct answer

`'rb'`

Objective/domain: 5. Miscellaneous - Comprehensions, Lambdas, Closures, and I/O (22%)

Source: Python Standard Library — io

Question 3 A pipeline must convert every input number to its square, then retain only squared values above 10. Which conceptual pairing is correct?

Answer choices

  1. A. Use `lambda` alone for both steps because `map` and `filter` cannot accept lambda functions.
  2. B. Use `filter` for the squaring transformation and `map` only to remove values below 10.
  3. C. Use `map` for both steps because `filter` can only operate on strings.
  4. D. Use `map` for the squaring transformation and `filter` for the greater-than-10 selection.

Correct answer

Use `map` for the squaring transformation and `filter` for the greater-than-10 selection.

Objective/domain: 5. Miscellaneous - Comprehensions, Lambdas, Closures, and I/O (22%)

Source: Python Functional Programming HOWTO

Question 4 Two separately obtained strings must be compared for the same textual value. Which operator is the correct semantic choice?

Answer choices

  1. A. Use `is` because equal strings are required to be the same object.
  2. B. Use `==` to compare their values.
  3. C. Use `in` because equality is defined as substring membership.
  4. D. Use `:=` because assignment expressions also compare string content.

Correct answer

Use `==` to compare their values.

Objective/domain: 3. Strings (18%)

Source: Python Standard Library — Built-in Types

Question 5 What escapes `validate()`? ```python class ValidationError(Exception): pass def validate(): try: raise ValidationError("bad") except ValidationError: print("audit") raise ```

Answer choices

  1. A. A new empty `ValidationError` replaces the original message before leaving the function.
  2. B. No exception; the handler consumes it because `raise` has no operand.
  3. C. A new `RuntimeError` is raised because a bare `raise` cannot be used with custom exceptions.
  4. D. The same `ValidationError` is re-raised after `audit` is printed.

Correct answer

The same `ValidationError` is re-raised after `audit` is printed.

Objective/domain: 2. Exceptions (14%)

Source: Python Tutorial — Errors and Exceptions

Question 6 What is printed? ```python class Ticket: prefix = "INC" a = Ticket() b = Ticket() print(a.prefix, b.prefix) ```

Answer choices

  1. A. `INC None`
  2. B. `INC INC`
  3. C. An `AttributeError`
  4. D. `None None`

Correct answer

`INC INC`

Objective/domain: 4. Object-Oriented Programming (34%)

Source: Python Tutorial — Classes

Question 7 A utility uses ```python from math import sqrt print(sqrt(81)) ``` Which namespace effect explains why `sqrt(81)` needs no `math.` prefix?

Answer choices

  1. A. The statement renames the `math` module itself to `sqrt` for the rest of the process.
  2. B. The `from math import sqrt` statement binds the selected name `sqrt` directly in the importing module's namespace.
  3. C. The statement changes Python's built-in `sqrt` function to point at `math.sqrt`.
  4. D. The statement imports every public name from `math` and merely displays `sqrt` first.

Correct answer

The `from math import sqrt` statement binds the selected name `sqrt` directly in the importing module's namespace.

Objective/domain: 1. Modules and Packages (12%)

Source: Python Tutorial — Modules

Question 8 What is printed? ```python print("bananana".rfind("na")) ```

Answer choices

  1. A. `4`
  2. B. `6`
  3. C. `2`
  4. D. `-1`

Correct answer

`6`

Objective/domain: 3. Strings (18%)

Source: Python Standard Library — Built-in Types

Question 9 What happens? ```python def parse(): return int("x") def run(): return parse() try: run() except ValueError: print("caught") ```

Answer choices

  1. A. Nothing is printed because exceptions cannot cross function-call boundaries.
  2. B. A `TypeError` replaces the `ValueError` when control returns from `parse()`.
  3. C. The interpreter retries `int('x')` once before allowing any outer handler to run.
  4. D. `caught` is printed because the unhandled `ValueError` propagates through `parse()` and `run()` to the matching outer handler.

Correct answer

`caught` is printed because the unhandled `ValueError` propagates through `parse()` and `run()` to the matching outer handler.

Objective/domain: 2. Exceptions (14%)

Source: Python Tutorial — Errors and Exceptions

Question 10 What is printed? ```python class Item: def __str__(self): return "ITEM" print(Item()) ```

Answer choices

  1. A. `ITEM`
  2. B. `<Item>` exactly
  3. C. `None`
  4. D. An `AttributeError`

Correct answer

`ITEM`

Objective/domain: 4. Object-Oriented Programming (34%)

Source: Python Language Reference — Data Model

Where to go after the daily web set

How are Python Institute PCAP questions generated?

dotCreds builds Python Institute PCAP practice questions from public exam objectives and Python Institute exam and documentation references. The questions are written for realistic study practice, not copied from exam dumps.

How are explanations sourced?

Each question includes an explanation and, when available, a source link back to the provider documentation or reference used to validate the answer. That keeps the practice tied to study material you can actually review.

What score do I get?

The page tracks today's answered count and accuracy for the 10-question daily set, then saves a 7-day score history on this device so you can see your recent practice trend.

Why use this site?

The site is the fastest way to start Python Institute PCAP practice without installing anything. It is built for daily recall, quick weak-topic discovery, and source-backed explanations you can review immediately.