PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A Python programmer wants to determine whether the variable n is an even number greater than zero. Which expression correctly evaluates to True only when n is a positive even integer?
⚠ Common exam trap
A common mix-up: candidates confuse the division operator with the modulo operator, or using or instead of and, which would admit odd or non-positive numbers.
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
✓
n % 2 == 0 and n > 0
Even numbers leave a remainder of zero when divided by two, which the modulo operator % detects. The comparison n > 0 filters out zero and negative values. Joining these with the logical and operator yields True only for positive even integers. Division and floor division do not test divisibility by two, and using or would accept odd values.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
n % 2 == 0 and n > 0
Why this is correct
The modulo operation n % 2 yields the remainder when n is divided by 2. For even integers the remainder is 0, so n % 2 == 0 is True. The comparison n > 0 ensures the number is positive. Combining them with and requires both conditions to hold, which exactly matches the requirement of a positive even integer.
- ✗
n % 2 == 1 or n > 0
Why it's wrong here
The remainder 1 indicates an odd number, so n % 2 == 1 is True for odd values like 3, which should not qualify. Using or means the expression is also True whenever n > 0, even for odd positives. This fails to restrict the result to positive even integers and would incorrectly accept many values.
- ✗
n / 2 == 0 and n > 0
Why it's wrong here
Dividing n by 2 with the / operator gives half of n, which is zero only when n itself is zero. For any positive even number such as 4, n / 2 equals 2.0, not 0, so this condition would be False. The modulo operator, not division, is needed to test evenness, making this expression incorrect for the scenario.
- ✗
n // 2 == 0 and n > 0
Why it's wrong here
Floor division n // 2 equals 0 only when n is 0 or 1. For a positive even number like 2, n // 2 is 1, so the condition would be False. This operator truncates the quotient and does not reveal whether n is divisible by 2, so it cannot test evenness as required.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 482 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
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.