Courseiva
Computer Programming and Python FundamentalshardMultiple ChoiceObjective-mapped

PCEP Computer Programming and Python Fundamentals Practice Question

Exhibit

x = 10
y = 5
if x > y:
    print("x greater")
elif x == y:
    print("equal")
else:
    print("y greater")

Refer to the exhibit. What is printed?

⚠ Common exam trap

The PCEP exam often tests the sequential evaluation of if-elif-else chains, where candidates mistakenly think multiple branches can execute or that the else branch runs when a prior condition is 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

x greater

The code defines x = 10 and y = 5. The if-elif-else structure first checks if x > y, which is true (10 > 5), so it prints 'x greater' and skips the remaining conditions. Therefore, option B is correct.

Answer analysis

Option-by-option breakdown

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

  • None

    Why it's wrong here

    Something is printed.

  • x greater

    Why this is correct

    The if condition is satisfied.

  • equal

    Why it's wrong here

    The elif is not evaluated because the if was true.

  • y greater

    Why it's wrong here

    The else only runs if all conditions are false.

About these practice questions

This PCEP question is part of Courseiva's 498-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.