PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Which THREE of the following expressions evaluate to the integer 1? (Select three.)
⚠ Common exam trap
The PCEP exam often tests the distinction between Boolean `True` and the integer `1`, and the fact that arithmetic with a float operand always yields a float, not an integer.
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
✓
int(1.0)
Option A, int(1.0), is correct because Python's int() constructor truncates the float 1.0 toward zero, yielding the integer 1. Option B, 2 // 2, is correct because floor division of 2 by 2 produces the integer quotient 1. Option E, 4 % 3, is correct because the modulo operator returns the remainder of 4 divided by 3, which is the integer 1. Option C, True == 1, evaluates to the Boolean True rather than the integer 1, even though True is numerically equal to 1 in Python. Option D, 1 * 1.0, evaluates to the float 1.0, not the integer 1, because multiplying an int by a float promotes the result to float.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
int(1.0)
Why this is correct
int() truncates a float toward zero, discarding the fractional part. Applying it to 1.0 yields the integer 1, satisfying the stem's requirement for an int result rather than a float. This is the explicit type-conversion route to the value 1.
- ✓
2 // 2
Why this is correct
Floor division // returns the largest integer not exceeding the true quotient. With 2 // 2 the quotient is exactly 1, so the result is the int 1, not the float 1.0. This satisfies the stem's demand for an integer-valued expression.
- ✗
True == 1
Why it's wrong here
True == 1 evaluates to the Boolean True, not the integer 1, because equality comparison returns a bool in Python. It is tempting since bool subclasses int and True equals 1 numerically. Expressions returning the actual int type, such as 1 // 1 or int(1.0), satisfy the question.
- ✗
1 * 1.0
Why it's wrong here
Multiplying an int by a float yields a float in Python, so 1 * 1.0 evaluates to 1.0, not the integer 1. It is tempting because the numeric value equals one, but type matters here. Integer-preserving expressions such as 1 // 1 or int(1.0) would qualify.
- ✓
4 % 3
Why this is correct
The modulo operator % returns the remainder of integer division. Dividing 4 by 3 gives quotient 1 with remainder 1, so 4 % 3 evaluates to the int 1. This remainder mechanism is what meets the stem's integer-1 requirement.
Go deeper
Related to this question
About these practice questions
One of 482 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.