PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Which THREE of the following expressions evaluate to True?
⚠ Common exam trap
Python Institute often tests the distinction between value comparison and assignment, but here the trap is that candidates may misread the operators (e.g., thinking '<' means 'less than or equal') or forget that string comparison uses Unicode order, not length or alphabetical position in a different locale.
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
✓
3 == 3
Option A (3 == 3) is correct because the equality operator compares the two integer literals 3 and 3, which are identical, so the expression evaluates to True. Option C ('a' < 'b') is correct because Python compares strings lexicographically by Unicode code point, and the code point of 'a' (97) is less than that of 'b' (98), yielding True. Option E (2 != 1) is correct because the inequality operator returns True when the operands differ, and 2 is not equal to 1. Option B (1 < 0) is not correct because 1 is greater than 0, so the less-than comparison evaluates to False. Option D (4 > 5) is not correct because 4 is less than 5, so the greater-than comparison evaluates to False.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
3 == 3
Why this is correct
Comparing two identical integer literals with the equality operator returns True, since `==` tests value equality rather than object identity. This satisfies the stem's requirement for an expression evaluating to True, and it is one of the three correct selections.
- ✗
1 < 0
Why it's wrong here
1 < 0 is False because 1 is greater than 0, so it cannot satisfy a question asking for True expressions. It is tempting as a comparison returning a bool, which is correct when testing whether a value falls below a threshold, but the numbers here are reversed.
- ✓
'a' < 'b'
Why this is correct
Comparing single characters uses their Unicode code point values, so 'a' (97) is less than 'b' (98), making the expression True. This satisfies the stem's requirement for expressions evaluating to True, since Python orders strings lexicographically by character code rather than by length or locale.
- ✗
4 > 5
Why it's wrong here
4 > 5 evaluates to False since 4 is less than 5, so it fails a question requiring True results. It is tempting because the > operator correctly tests greater-than relationships, which would hold for pairs such as 5 > 4.
- ✓
2 != 1
Why this is correct
The expression `2 != 1` evaluates to True because the inequality operator compares the two integer operands and finds them unequal. Since 2 and 1 are distinct values, the comparison returns the Boolean True, satisfying the question's requirement for expressions that evaluate to True.
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.