Courseiva

PCEP Practice Question: Data Types, Variables, Basic I/O and Operators

Which of the following expressions evaluate to True? (Choose three.)

⚠ Common exam trap

The PCEP exam often tests the distinction between the modulo operator returning the remainder (not the quotient) and the falsy nature of zero, leading candidates to mistakenly think `10 % 3 == 0` or `bool(0)` evaluate to `True`.

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 ** 2 == 9

Option A is correct because the exponentiation operator ** raises 3 to the power of 2, yielding 9, and 9 == 9 evaluates to True. Option B is correct because in Python, comparing a float and an int with == performs numeric value comparison: 4.0 and 4 represent the same numeric value, so 4.0 == 4 is True. Option D is correct because the in operator performs a substring membership test on strings, and the substring "Py" occurs at the start of "Python", so the expression is True. Option C is not correct because 10 % 3 returns the remainder 1 (not 0), so 1 == 0 is False. Option E is not correct because bool(0) evaluates to False, not True, since zero is a falsy value in Python.

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 ** 2 == 9

    Why this is correct

    Raising 3 to the power of 2 via the exponentiation operator yields 9, so the equality comparison returns True. This satisfies the stem's requirement for expressions evaluating to True, since Python's ** operator binds tighter than ==, making the comparison 9 == 9.

  • ✓

    4.0 == 4

    Why this is correct

    Comparing a float and an integer with `==` performs numeric value comparison in Python, so `4.0 == 4` evaluates to True despite differing types. This satisfies the stem's requirement for expressions yielding True, since Python does not require matching types for equality between numeric operands.

  • ✗

    10 % 3 == 0

    Why it's wrong here

    10 % 3 returns 1, so the comparison with 0 is False. It is tempting because the modulo operator is genuinely used to test divisibility, and the expression would evaluate to True if the left operand were a multiple of three, such as 9 % 3 == 0.

  • ✓

    "Py" in "Python"

    Why this is correct

    The membership operator `in` returns True when the left operand occurs as a substring within the right operand. Here "Py" appears at the start of "Python", so the expression evaluates to True. Case sensitivity matters: "py" would return False.

  • ✗

    bool(0)

    Why it's wrong here

    bool(0) evaluates to False, since zero is falsy in Python. It is tempting because bool() converts values to True or False, and would return True for any non-zero number or non-empty object, making it the correct choice in a question asking which expressions are falsy.

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 →

How Courseiva writes practice questions · Editorial policy

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.