PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A script uses the // operator with negative numbers. For example, -7 // 2 returns -4. The developer expected -3. Which statement best explains this behavior?
⚠ Common exam trap
Python Institute often tests the distinction between floor division (rounding down) and truncation toward zero, exploiting the common misconception that integer division always discards the fractional part, which is true in languages like C or Java but not in Python.
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
✓
The // operator performs floor division, which rounds down to the next lower integer.
In Python, the // operator performs floor division, which always rounds down to the next lower integer (toward negative infinity). For -7 // 2, the exact result is -3.5, and floor division rounds down to -4, not -3. This behavior is defined by the Python language specification and differs from truncation toward zero.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The // operator uses banker's rounding.
Why it's wrong here
Incorrect: banker's rounding is for round().
- ✗
The // operator truncates toward zero for negative numbers.
Why it's wrong here
Incorrect: truncation toward zero would give -3.
- ✗
The // operator performs integer division with rounding to the nearest even integer.
Why it's wrong here
Incorrect: not rounding to even.
- ✓
The // operator performs floor division, which rounds down to the next lower integer.
Why this is correct
Correct: floor division rounds toward negative infinity.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 498 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.