Question 34 of 498
PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A developer writes the following code: x = 5; y = 2; print(x // y). What is the output?
⚠ Common exam trap
Python Institute often tests the distinction between floor division (//) and true division (/), trapping candidates who confuse the two operators or forget that integer operands produce an integer result with //.
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
The floor division operator (//) in Python returns the largest integer less than or equal to the result of the division. Since 5 divided by 2 equals 2.5, the floor is 2, and the result is an integer (int) because both operands are integers. Therefore, the output is 2.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
1
Why it's wrong here
Incorrect calculation.
- ✓
2
Why this is correct
Floor division of 5 by 2 yields 2.
- ✗
2.0
Why it's wrong here
Floor division returns int if both operands are ints.
- ✗
2.5
Why it's wrong here
This would be the result of /, not //.
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
2 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 code in the exhibit?
medium- ✓ A.3
- B.4
- C.3.0
- D.3.3333333333333335
Why A: The code performs integer division using the // operator, which in Python returns the floor of the division result for positive numbers. Since 10 // 3 equals 3 (the integer part of 10/3), the output is 3. Option A is correct because integer division discards the fractional part.
Variation 2. Given the exhibit, what does the code print?
hard- ✓ A.3.0
- B.3
- C.3.5
- D.3.5
Why A: The code likely performs floor division with at least one float operand (e.g., print(7.0 // 2) or print(7 // 2.0)). Floor division // returns the largest integer less than or equal to the quotient, but if either operand is a float, the result is a float. Since 7.0 // 2 = 3.0, the output is 3.0. If both operands were integers, the result would be the integer 3, not 3.0. Thus option A (3.0) is correct.
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.