Courseiva
Data Types, Variables, Basic I/O and OperatorsmediumMultiple SelectObjective-mapped

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)

`bool(1)` converts the integer 1 to a Boolean, and in Python any non-zero numeric value is considered truthy, so `bool(1)` returns `True`. Option D is correct because `bool('False')` converts the non-empty string `'False'` to a Boolean; in Python, any non-empty string is truthy, regardless of its textual content, so it returns `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.

  • bool('')

    Why it's wrong here

    Empty string is False.

  • bool([])

    Why it's wrong here

    Empty list is False.

  • bool(1)

    Why this is correct

    Non-zero integer is True.

  • bool('False')

    Why this is correct

    Non-empty string is True.

  • bool(0)

    Why it's wrong here

    Integer 0 is False.

About these practice questions

One of 498 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.