PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Exhibit
Refer to the exhibit. ```python a = 10 b = 3 print(a / b) print(a // b) print(a % b) ```
Refer to the exhibit. Which of the following shows the correct output?
⚠ Common exam trap
Watch out — candidates often confuse the behavior of the `/` operator (which always returns a float in Python 3) with integer division from Python 2, or they misapply floor division and remainder operations, especially when dealing with positive 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
✓
3.3333333333333335 3 1
The code `print(10/3)` performs floating-point division in Python 3, yielding `3.3333333333333335`; `print(10//3)` performs floor division, which truncates to the nearest integer less than or equal to the result, giving `3`; and `print(10%3)` computes the remainder of the division, which is `1`.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
3.3333333333333335 4 1
Why it's wrong here
Floor division should be 3, not 4.
- ✓
3.3333333333333335 3 1
Why this is correct
Correct outputs.
- ✗
3.0 3.0 1.0
Why it's wrong here
Floor division and modulus return int when both ints.
- ✗
3 3 0
Why it's wrong here
Division yields float, and remainder is 1.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 498-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
8 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 print(10 // 3, 10 % 3)?
medium- A.1 3
- B.3.33 1
- C.3 3
- ✓ D.3 1
Why D: The // operator performs floor division, which divides 10 by 3 and discards the fractional part, yielding 3. The % operator returns the remainder of that division, which is 1. The print function outputs both values separated by a space, resulting in '3 1'.
Variation 2. Which two of the following expressions return the value 5? (Choose two.)
hard- A.10 % 5
- ✓ B.10 // 2
- C.10 ** 0
- D.10 / 2
- ✓ E.5 * 1
Why B: (10 // 2) uses floor division, which divides 10 by 2 and returns the integer quotient 5. This is correct because floor division in Python discards any fractional remainder, yielding an exact integer result.
Variation 3. Given 'a = 10; b = 3; c = a // b; d = a % b', what is the value of c + d?
hard- ✓ A.4
- B.5
- C.7
- D.6
Why A: In Python, the // operator performs floor division, so a // b = 10 // 3 = 3. The % operator returns the remainder, so a % b = 10 % 3 = 1. Therefore, c + d = 3 + 1 = 4, making option A correct.
Variation 4. Refer to the exhibit. What is the output?
easy- A.3.0 1.0
- B.3 3
- C.3.333 1
- ✓ D.3 1
Why D: The code in the exhibit is `print(10//3, 10%3)`. The `//` operator performs floor division, which for positive numbers truncates the decimal part, so `10//3` yields 3. The `%` operator returns the remainder of the division, `10%3` yields 1. Thus the output is '3 1'.
Variation 5. Which operator performs integer (floor) division in Python?
easy- ✓ A.//
- B.%
- C./
- D.**
Why A: The // operator performs integer (floor) division in Python, which divides two numbers and returns the largest integer less than or equal to the result. For example, 7 // 2 returns 3, not 3.5, because it discards the fractional part and rounds down toward negative infinity for negative numbers.
Variation 6. What is the output of: print(10 // 3, 10 % 3)?
easy- A.3.3333 1
- ✓ B.3 1
- C.3.0 1.0
- D.1 3
Why B: The // operator performs floor division, returning the integer quotient (10 // 3 = 3), and the % operator returns the remainder (10 % 3 = 1). The print function outputs these two values separated by a space.
Variation 7. Which operator is used for integer division in Python?
easy- A.%
- B.**
- C./
- ✓ D.//
Why D: The // operator in Python performs floor division, which returns the integer quotient after dividing two numbers, discarding any fractional remainder. For example, 7 // 2 yields 3, not 3.5, making it the explicit integer division operator.
Variation 8. What is the output from the interactive Python session?
easy- A.3.333 1
- ✓ B.3 1
- C.1 3
- D.3 0
Why B: The expression `10 // 3` performs integer (floor) division, which discards the fractional part and returns the integer quotient 3. The expression `10 % 3` returns the remainder of the division, which is 1. Therefore, the output is `3 1`, making option B correct.
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.