Courseiva

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

A Python script contains:

print(10 / 4)
print(10 // 4)
print(10 % 4)

What output does this produce?

⚠ Common exam trap

The trap here is assuming that the single slash / truncates like floor division, when it actually returns a float even for evenly divisible integers.

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, 2, 2

True division with / yields a float result, while floor division with // discards the fractional part to give a whole number, and the modulo operator % gives the remainder. For 10 and 4, these produce 2.5, 2, and 2 respectively. Recognizing that / and // behave differently is essential when predicting numeric output in Python.

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, 2, 2

    Why it's wrong here

    This option incorrectly assumes true division also truncates. The single slash / performs floating-point division and yields 2.5 for 10 / 4. The double slash and modulo lines happen to give 2 and 2, but the first line is wrong, so the entire printed sequence is incorrect for this script.

  • ✓

    2.5, 2, 2

    Why this is correct

    The true division operator / always returns a float, so 10 / 4 gives 2.5. Floor division // returns the whole-number part of the quotient, so 10 // 4 gives 2. The modulo % returns the remainder, and 4 goes into 10 twice with 2 left over, so 10 % 4 gives 2. All three lines match these expected results.

  • ✗

    2.5, 2.5, 2

    Why it's wrong here

    This option wrongly treats floor division as if it returned a float. The // operator produces an integer when both operands are integers, discarding the fractional part after division. Only the first line uses true division and returns 2.5; the second line would be 2, not 2.5, so this sequence fails on the middle value.

  • ✗

    2.5, 2, 0.5

    Why it's wrong here

    This option confuses modulo with the fractional remainder as a decimal. The % operator returns the integer remainder 2 when dividing 10 by 4, not 0.5. The first two lines are correct, but the third line is wrong because 10 modulo 4 equals 2, not 0.5, making the sequence inaccurate.

About these practice questions

Courseiva writes every PCEP question from scratch — 482 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.