Courseiva

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

Which TWO of the following expressions evaluate to True?

⚠ Common exam trap

The trap here is that candidates often mistakenly think the string `'False'` is falsy because it looks like the Boolean `False`, but Python evaluates truthiness based on the object's type and content, not its string representation.

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

✓

bool(1)

Option C, bool(1), evaluates to True because any non-zero integer is truthy in Python, and 1 is the canonical non-zero value. Option D, bool('False'), also evaluates to True because any non-empty string is truthy regardless of its content — the string 'False' has five characters, so it is truthy. The unmarked options do not belong: bool('') is False because an empty string is falsy, bool([]) is False because an empty list is falsy, and bool(0) is False because zero is the integer falsy value.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    bool('')

    Why it's wrong here

    bool('') converts an empty string, which is falsy, so it evaluates to False. It is tempting because empty strings are often treated as absent values in other languages, and bool('') would be correct only if the string contained a non-empty truthy value such as 'False' or '0'.

  • ✗

    bool([])

    Why it's wrong here

    bool([]) converts an empty list, which is falsy, so it evaluates to False. It is tempting because non-empty lists are truthy, and bool([]) would be correct only when the list contains at least one element, making the expression evaluate to True.

  • ✓

    bool(1)

    Why this is correct

    `bool(1)` returns True because Python's truth-value testing converts any non-zero integer to True, and only zero is falsy among integers. This satisfies the stem's requirement for an expression evaluating to True, since the integer literal 1 is non-zero.

  • ✓

    bool('False')

    Why this is correct

    The string `'False'` contains five characters, so it is non-empty. Python's `bool()` returns `True` for any non-empty string, regardless of the text's meaning. This satisfies the stem's requirement for an expression evaluating to `True`, since only genuinely empty strings such as `''` convert to `False`.

  • ✗

    bool(0)

    Why it's wrong here

    bool(0) returns False because zero is falsy, so it cannot satisfy a question asking for True expressions. It tempts candidates who recall that bool() converts any integer, but that conversion preserves truthiness: only non-zero integers yield True.

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.