PCEP Logical operators Practice Question
Which logical expression evaluates to True given that a = 5 and b = 10?
⚠ Common exam trap
PCEP often tests operator precedence and De Morgan's laws, tricking candidates who mis-evaluate not (a > b) as (not a) > b or who confuse the negation of a comparison with the comparison of a negation.
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
✓
not (a > b)
Given a = 5 and b = 10, the expression not (a > b) evaluates the inner comparison a > b, which is 5 > 10 = False, and then applies not, yielding True. This is the only option that evaluates to True with the given values. Understanding operator precedence and boolean negation is essential for PCEP-style questions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
a > b and b < 0
Why it's wrong here
With a = 5 and b = 10, a > b is False, so the conjunction is False regardless of the second operand. It is tempting because it pairs two comparisons, but the and operator requires both sides True, and neither condition holds here.
- ✗
not (a < b)
Why it's wrong here
With a = 5 and b = 10, a < b is True, so not (a < b) evaluates to False. It is tempting because negation often flips a result to True, but here it inverts an already-true comparison, yielding False.
- ✓
not (a > b)
Why this is correct
With a = 5 and b = 10, the comparison a > b evaluates to False, and the not operator inverts that to True. This satisfies the logical expression's requirement of producing a True result.
- ✗
a == b or False
Why it's wrong here
With a = 5 and b = 10, a == b is False, and False or False remains False. It is tempting because the or operator can produce True, but that requires at least one True operand, and both sides here are False.
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 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.