Question 224 of 498
PCEP Computer Programming and Python Fundamentals Practice Question
A developer needs to check if a number is positive and even. Which conditional expression is correct?
⚠ Common exam trap
The PCEP exam often tests the distinction between logical operators (`and`, `or`) and bitwise operators (`&`, `|`), as well as the difference between assignment (`=`) and comparison (`==`), to catch candidates who confuse syntax from other programming languages.
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
✓
if num > 0 and num % 2 == 0:
Python uses the keyword `and` for logical conjunction, and the equality operator is `==` (not `=`). The expression `num > 0 and num % 2 == 0` correctly checks that `num` is both greater than zero and divisible by 2 with no remainder, which defines a positive even number.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
if num > 0 & num % 2 == 0:
Why it's wrong here
& is bitwise AND, different precedence.
- ✗
if num > 0 and num % 2 = 0:
Why it's wrong here
Assignment = instead of comparison ==
- ✗
if num > 0 && num % 2 == 0:
Why it's wrong here
&& is not Python syntax; use 'and'.
- ✓
if num > 0 and num % 2 == 0:
Why this is correct
Correct syntax.
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 →
Last reviewed: Jul 4, 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.