PCEP Computer Programming and Python Fundamentals Practice Question
A programmer writes:
x = 10 y = 4
print(x // y, x % y, x / y)
What is printed?
⚠ Common exam trap
It's easy for candidates to confuse the results of //, %, and /, especially assuming that % returns a fractional part or that // 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 2 2.5
The floor division operator // returns the largest integer less than or equal to the quotient, so 10 // 4 is 2. The modulus operator % returns the remainder, so 10 % 4 is 2. True division / returns a float, so 10 / 4 is 2.5. Printing these in order gives '2 2 2.5'.
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 0.5 2.5
Why it's wrong here
The remainder of 10 divided by 4 is 2, not 0.5. The modulus operator returns the integer remainder when both operands are integers. A value like 0.5 would result from a fractional operation, which is not what % computes here.
- ✗
2 2 2.0
Why it's wrong here
While 10 / 4 is indeed 2.5, this option lists 2.0. True division of two integers in Python 3 yields a float with the exact quotient, so 10 / 4 is 2.5, not 2.0. The floor division and modulus parts are correct, but the final value is wrong.
- ✓
2 2 2.5
Why this is correct
The // operator performs floor division: 10 // 4 equals 2 because 4 goes into 10 twice. The % operator gives the remainder: 10 % 4 equals 2. The / operator performs true division and returns a float: 10 / 4 equals 2.5. Printed together, they produce '2 2 2.5'.
- ✗
2.5 2 2
Why it's wrong here
This option swaps the results. The floor division x // y gives 2, not 2.5; the modulus x % y gives 2; and true division x / y gives 2.5. So the order '2.5 2 2' does not match the actual values produced by these operators.
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.