PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A developer writes the following code: a = 3; b = 2; c = a / b; d = a // b; e = a % b. What are the values of c, d, e?
⚠ Common exam trap
It's easy for candidates to confuse the / operator (true division) with the // operator (floor division) and mistakenly think // returns a float, or they miscalculate the remainder by assuming it is always the fractional part of the division.
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
✓
c=1.5, d=1, e=1
In Python, the / operator performs true division, yielding a float result (3/2 = 1.5). The // operator performs floor division, which for positive numbers truncates the decimal part, giving 1. The % operator returns the remainder of the division, which is 3 - (1 * 2) = 1. Thus c=1.5, d=1, e=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.
- ✗
c=1, d=1, e=1
Why it's wrong here
Integer division truncates, so d equals 1, but true division always returns a float: c is 1.5, and the remainder e is 1. The option collapses all three results to integers, ignoring that the / operator produces a float in Python 3.
- ✗
c=1.5, d=1, e=0
Why it's wrong here
In Python 3, a % b yields the remainder of integer division: 3 % 2 equals 1, not 0. The option correctly gives c=1.5 from true division and d=1 from floor division, but misstates the modulo result, so the triple is wrong.
- ✓
c=1.5, d=1, e=1
Why this is correct
True division a / b yields 1.5 as a float, floor division a // b yields 1, and modulo a % b yields 1. These three results match the stem's expected values c=1.5, d=1, e=1, correctly distinguishing the three division-related operators.
- ✗
c=1.5, d=1.5, e=0
Why it's wrong here
The // operator performs floor division on integers, yielding 1, not 1.5, and 3 % 2 leaves remainder 1, not 0. Confusing // with true division and miscomputing the modulus both stem from assuming every operator returns a fractional result.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 482-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 →
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.