PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
Which of the following expressions will evaluate to True?
⚠ Common exam trap
Python Institute often tests the misconception that `==` requires identical data types, leading candidates to think `3 == 3.0` is `False`, or that operator precedence is left-to-right without considering multiplication before addition.
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.0
Python's `==` operator performs value equality comparison, and the integer `3` and the float `3.0` represent the same numeric value. Python automatically converts the integer to a float for comparison, so `3 == 3.0` evaluates to `True`.
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.0
Why this is correct
Python's numeric equality compares values across int and float types, so 3 and 3.0 are equal despite differing types. The expression therefore evaluates to True, satisfying the question's requirement for an expression that yields True.
- ✗
2 + 2 * 2 == 8
Why it's wrong here
Python evaluates multiplication before addition, so 2 + 2 * 2 yields 6, and 6 == 8 is False. It is tempting because reading strictly left to right gives 8, which would make the comparison True, but operator precedence for * over + prevents that result.
- ✗
10 / 3 == 3
Why it's wrong here
In Python 3, 10 / 3 uses true division and yields 3.333..., so it does not equal 3. It tempts because 10 // 3 (floor division) returns exactly 3, making that variant the expression which would evaluate True.
- ✗
'a' > 'b'
Why it's wrong here
Python compares strings by Unicode code point, and 'a' (97) is less than 'b' (98), so the expression returns False. It tempts because reversed operands, 'b' > 'a', would evaluate True, and lexicographic ordering is a genuine Python comparison feature.
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 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.