Python PCEP Certification 2025 — 60 Practice Questions
Fundamentals Verified
Series:
CrashCourses Professional Study Series
Author:
Dr Z. Moomba, MBChB, MRCPsych | BethelWellness Ltd
Exam Target:
Python Institute PCEP
Year:
2025/2026
Format:
60 Questions with Verified Answers and Rationales
>
Author's Note:
This document is an original work produced for the CrashCourses Professional Study Series.
Clinical questions and professional scenarios were composed by Dr Z. Moomba based on current
exam objectives, published guidelines, and evidence-based sources (2024–2025). All patient
names, ages, and case details are fictional. Any resemblance to existing published Q&A banks is
coincidental. For personal study use only — not for reproduction or redistribution.
PART 1: CORE PRINCIPLES & FOUNDATIONS
Question 1
A triage nurse at a London A&E enters a patient's age into a custom Python interface. The prompt
reads: `patient_age = input("Input age in years: ")`. If the nurse types `40` and the system
subsequently evaluates `type(patient_age)`, what will be returned?
A) The integer class type ``
B) The floating-point class type ``
C) The string class type ``
D) The character class type ``
,Answer: C
Rationale:
Lead:
In Python 3, the `input()` function inherently processes all standard user input as string objects,
regardless of whether the user enters strictly numerical digits.
Discriminator:
The explicit absence of a casting function (such as `int()`) around the `input()` call dictates that the
data retains its original string format.
Distractor:
Option A is the most compelling error, as `40` is logically an integer, but the interpreter does not
automatically infer or convert data types from standard input streams.
Examiner Insight:
Attempting mathematical operations on uncast input data (such as calculating clinical scores) will
trigger a `TypeError`; always manually cast variables [Python Docs 2025].
Question 2
An epidemiologist in a field clinic is declaring a variable to store a patient's baseline resting heart
rate. Which identifier adheres to Python's legal naming rules?
A) `1_resting_hr`
B) `resting-hr`
C) `_resting_hr`
D) `resting hr`
Answer: C
Rationale:
Lead:
Python variable identifiers may only consist of alphanumeric characters and underscores, and
they must never commence with a numeric digit.
Discriminator:
,`_resting_hr` strictly follows these lexical rules, successfully utilizing an underscore as a valid
starting character.
Distractor:
Option B (`resting-hr`) appears logical to beginners but introduces a hyphen, which the Python
interpreter evaluates as a subtraction operator, throwing a `SyntaxError`.
High-Yield Point:
A leading underscore is a strong PEP 8 convention indicating that a variable or method is intended
for internal use within a specific module [PEP 8].
Question 3
A blood bank script calculates the leftover units of O-negative blood after equal distribution
among 3 trauma wards. The code executes: `print(10 % 3)`. What value is displayed?
A) 3.33
B) 3
C) 1
D) 0
Answer: C
Rationale:
Lead:
The modulo operator `%` evaluates the division of two numbers and returns strictly the
mathematical remainder.
Discriminator:
Dividing 10 by 3 yields a quotient of 3 with a remainder of 1; the operator isolates and outputs this
remainder.
Distractor:
Option B represents the result of floor division (`//`), a frequent point of confusion when parsing
mathematical operators in Python.
Clinical Pearl:
Modulo arithmetic is heavily utilized in healthcare scheduling algorithms to calculate shift rotations
or determine if a specific date falls on a cycle boundary [AWS Docs 2025].
, Question 4
A pharmacy inventory script utilizes the walrus operator to simultaneously evaluate and assign
medication stock levels. Which implementation correctly applies this feature?
A) `if (inventory := check_inventory()) > 0:`
B) `if inventory := check_inventory() > 0:`
C) `if (inventory = check_inventory()) > 0:`
D) `if inventory == check_inventory() > 0:`
Answer: A
Rationale:
Lead:
The walrus operator `:=` enables assignment of a value to a variable within an expression.
Parentheses are strictly necessary here to enforce the correct order of evaluation.
Discriminator:
The parentheses guarantee that the result of `check_inventory()` is bound to `inventory` before the
`> 0` comparison occurs.
Distractor:
Option B is syntactically valid but logically flawed; it assigns the boolean result of the comparison
(`True` or `False`) to the variable rather than the actual stock integer.
Key Principle:
This operator is highly efficient for reducing redundant function calls within clinical `while` loops
and complex conditional branching [PEP 572].
Question 5
A telemetry script formats a patient's surname and bed number using an f-string. The assigned
variables are `surname = "Patel"` and `bed = 12`. Which syntax correctly implements the f-string?
A) `f"Patient {surname} is in Bed {bed}"`
B) `"Patient {surname} is in Bed {bed}".format(f)`
C) `f("Patient {surname} is in Bed {bed}")`
D) `format("Patient {surname} is in Bed {bed}")`
Fundamentals Verified
Series:
CrashCourses Professional Study Series
Author:
Dr Z. Moomba, MBChB, MRCPsych | BethelWellness Ltd
Exam Target:
Python Institute PCEP
Year:
2025/2026
Format:
60 Questions with Verified Answers and Rationales
>
Author's Note:
This document is an original work produced for the CrashCourses Professional Study Series.
Clinical questions and professional scenarios were composed by Dr Z. Moomba based on current
exam objectives, published guidelines, and evidence-based sources (2024–2025). All patient
names, ages, and case details are fictional. Any resemblance to existing published Q&A banks is
coincidental. For personal study use only — not for reproduction or redistribution.
PART 1: CORE PRINCIPLES & FOUNDATIONS
Question 1
A triage nurse at a London A&E enters a patient's age into a custom Python interface. The prompt
reads: `patient_age = input("Input age in years: ")`. If the nurse types `40` and the system
subsequently evaluates `type(patient_age)`, what will be returned?
A) The integer class type ``
B) The floating-point class type ``
C) The string class type ``
D) The character class type ``
,Answer: C
Rationale:
Lead:
In Python 3, the `input()` function inherently processes all standard user input as string objects,
regardless of whether the user enters strictly numerical digits.
Discriminator:
The explicit absence of a casting function (such as `int()`) around the `input()` call dictates that the
data retains its original string format.
Distractor:
Option A is the most compelling error, as `40` is logically an integer, but the interpreter does not
automatically infer or convert data types from standard input streams.
Examiner Insight:
Attempting mathematical operations on uncast input data (such as calculating clinical scores) will
trigger a `TypeError`; always manually cast variables [Python Docs 2025].
Question 2
An epidemiologist in a field clinic is declaring a variable to store a patient's baseline resting heart
rate. Which identifier adheres to Python's legal naming rules?
A) `1_resting_hr`
B) `resting-hr`
C) `_resting_hr`
D) `resting hr`
Answer: C
Rationale:
Lead:
Python variable identifiers may only consist of alphanumeric characters and underscores, and
they must never commence with a numeric digit.
Discriminator:
,`_resting_hr` strictly follows these lexical rules, successfully utilizing an underscore as a valid
starting character.
Distractor:
Option B (`resting-hr`) appears logical to beginners but introduces a hyphen, which the Python
interpreter evaluates as a subtraction operator, throwing a `SyntaxError`.
High-Yield Point:
A leading underscore is a strong PEP 8 convention indicating that a variable or method is intended
for internal use within a specific module [PEP 8].
Question 3
A blood bank script calculates the leftover units of O-negative blood after equal distribution
among 3 trauma wards. The code executes: `print(10 % 3)`. What value is displayed?
A) 3.33
B) 3
C) 1
D) 0
Answer: C
Rationale:
Lead:
The modulo operator `%` evaluates the division of two numbers and returns strictly the
mathematical remainder.
Discriminator:
Dividing 10 by 3 yields a quotient of 3 with a remainder of 1; the operator isolates and outputs this
remainder.
Distractor:
Option B represents the result of floor division (`//`), a frequent point of confusion when parsing
mathematical operators in Python.
Clinical Pearl:
Modulo arithmetic is heavily utilized in healthcare scheduling algorithms to calculate shift rotations
or determine if a specific date falls on a cycle boundary [AWS Docs 2025].
, Question 4
A pharmacy inventory script utilizes the walrus operator to simultaneously evaluate and assign
medication stock levels. Which implementation correctly applies this feature?
A) `if (inventory := check_inventory()) > 0:`
B) `if inventory := check_inventory() > 0:`
C) `if (inventory = check_inventory()) > 0:`
D) `if inventory == check_inventory() > 0:`
Answer: A
Rationale:
Lead:
The walrus operator `:=` enables assignment of a value to a variable within an expression.
Parentheses are strictly necessary here to enforce the correct order of evaluation.
Discriminator:
The parentheses guarantee that the result of `check_inventory()` is bound to `inventory` before the
`> 0` comparison occurs.
Distractor:
Option B is syntactically valid but logically flawed; it assigns the boolean result of the comparison
(`True` or `False`) to the variable rather than the actual stock integer.
Key Principle:
This operator is highly efficient for reducing redundant function calls within clinical `while` loops
and complex conditional branching [PEP 572].
Question 5
A telemetry script formats a patient's surname and bed number using an f-string. The assigned
variables are `surname = "Patel"` and `bed = 12`. Which syntax correctly implements the f-string?
A) `f"Patient {surname} is in Bed {bed}"`
B) `"Patient {surname} is in Bed {bed}".format(f)`
C) `f("Patient {surname} is in Bed {bed}")`
D) `format("Patient {surname} is in Bed {bed}")`