Courseiva

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

Evaluate the expression: not (True or False) and (False or True). What is the result?

⚠ Common exam trap

The trap here is that candidates often forget the precedence of `not` over `and` and `or`, or misapply short-circuit evaluation, leading them to incorrectly compute the result as `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

✓

False

The expression is evaluated step by step: first, `True or False` evaluates to `True`; then `False or True` evaluates to `True`; the `not` operator negates the first `True` to `False`; finally, `False and True` evaluates to `False`. Therefore, the correct answer is C.

Answer analysis

Option-by-option breakdown

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

  • ✗

    SyntaxError

    Why it's wrong here

    The expression is syntactically valid Python: not, parentheses, or and and with boolean literals all parse correctly, so no SyntaxError is raised. It is tempting because mixing not with parentheses can look malformed, but the parser accepts it and evaluation yields False.

  • ✗

    True

    Why it's wrong here

    not (True or False) is False, and False and (False or True) is False, so the whole expression evaluates to False, not True. It is tempting because the inner or terms contain True values, but the leading not and the and operator force the result to False.

  • ✓

    False

    Why this is correct

    Evaluating the parentheses first: `(True or False)` yields True, and `(False or True)` yields True. Applying `not` to the first gives False, since `not True` is False. The final `and` combines False with True, producing False, satisfying the Boolean precedence rules tested here.

  • ✗

    None

    Why it's wrong here

    None is not a Python boolean literal; the expression evaluates to a bool. It is tempting because None represents absence of value, but the operators not, or and and always return True or False here, so the result is False, not None.

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.