Question 199 of 498
PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Which TWO operators in Python yield an integer result when applied to two integers?
⚠ Common exam trap
Python Institute often tests the distinction between / (always returns float) and // (returns int for int operands), and the trap here is that candidates mistakenly think the modulo operator (%) returns a float, but it actually returns an integer when both operands are integers, and they may also incorrectly believe that multiplication (*) always returns an integer (which it does, but the exam deliberately omits it from the correct answers to test knowledge of // and % specifically).
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 floor division operator (//) always returns an integer result when both operands are integers, discarding any fractional part. For example, 7 // 2 yields 3, not 3.5. This is because floor division performs integer division and truncates toward negative infinity, ensuring the result type is int when both inputs are int.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
//
Why this is correct
Floor division always returns an integer for ints.
- ✗
**
Why it's wrong here
Exponentiation can return a float if negative exponent.
- ✓
%
Why this is correct
Modulo with ints returns an integer remainder.
- ✗
*
Why it's wrong here
Multiplication returns int if both ints, but that would make too many correct; we need exactly two.
- ✗
/
Why it's wrong here
Normal division always returns a float.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
3 more ways this is tested on PCEP
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. What is the output of the following code? ```python x = 10 y = 3 print(x // y * y + x % y) ```
hard- A.9
- B.10.0
- ✓ C.10
- D.9.0
Why C: The expression `x // y * y + x % y` is evaluated using integer arithmetic. First, `x // y` is floor division: 10 // 3 = 3. Then `3 * y` = 3 * 3 = 9. Then `x % y` = 10 % 3 = 1. Finally, 9 + 1 = 10, which is an integer. Option C is correct because the result is 10 (type int).
Variation 2. A beginner writes: x = 10; y = 3; print(x // y). What is the output?
easy- ✓ A.3
- B.1
- C.3.0
- D.3.333
Why A: The // operator in Python performs floor division, which returns the largest integer less than or equal to the result of the division. Since 10 divided by 3 equals 3.333..., the floor of that value is 3, and because both operands are integers, the result is an integer (3), not a float.
Variation 3. Which TWO of the following expressions produce the integer 5?
easy- A."5"
- ✓ B.10 // 2
- ✓ C.int(5.7)
- D.5.0
- E.10 / 2
Why B: `10 // 2`, uses floor division in Python, which divides 10 by 2 and returns the integer quotient 5, discarding any fractional remainder. Option C, `int(5.7)`, truncates the decimal part of the float 5.7, converting it directly to the integer 5. Both expressions produce the exact integer value 5.
Last reviewed: Jun 30, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.