PCEP Computer Programming and Python Fundamentals Practice Question
A Python program contains the following code:
print(10 / 4)
What is displayed when this program runs?
⚠ Common exam trap
The trap here is assuming Python 3 behaves like languages where dividing two integers discards the remainder, when the / operator actually returns a float.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
2.5
In Python 3, the single forward slash performs true division regardless of operand types, so 10 / 4 evaluates to the float 2.5. Floor division with // would instead produce 2, and integer truncation does not happen with /. The print function then displays that float value on the console.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
2
Why it's wrong here
The value 2 would be produced by floor division using the // operator, which discards the fractional part and returns an integer when both operands are integers. The scenario uses the single-slash operator /, which performs true division and keeps the decimal portion, so truncation to 2 does not occur here.
- ✗
2.0
Why it's wrong here
The value 2.0 resembles a division result but does not match this computation. It would appear if the operands divided evenly, such as 8 / 4. Since 10 divided by 4 leaves a remainder, the true quotient includes the fractional .5, so the displayed value must be 2.5 rather than a whole-number float.
- ✗
A TypeError is raised.
Why it's wrong here
A TypeError occurs when operations are applied to incompatible types, such as adding a string to an integer. Dividing two integers is perfectly valid in Python 3, so no exception is raised. The division operator accepts numeric operands and simply returns the true quotient as a float.
- ✓
2.5
Why this is correct
The division operator / always performs true division in Python 3, even when both operands are integers, and returns a float. Dividing 10 by 4 yields 2.5, so 2.5 is printed. This differs from some other languages where integer division truncates the result, but Python 3 deliberately returns the exact quotient as a float.
Go deeper
Related to this question
About these practice questions
One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.