PCEP Control Flow, Loops, Lists and Logic Practice Question
Exhibit
x = 10
y = 5
if x > 5 and y < 10:
result = 'A'
elif x == 10 or y == 5:
result = 'B'
else:
result = 'C'
print(result)Refer to the exhibit. What is printed?
⚠ Common exam trap
Python Institute often tests the misconception that `break` only exits the current iteration or that the loop continues after the break, leading candidates to think multiple values are printed.
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
✓
A
The code uses a `for` loop to iterate over the list `['A', 'B', 'C']`. The `break` statement inside the loop executes when the variable `letter` equals `'A'`, immediately terminating the loop. Therefore, only `'A'` is printed before the loop ends, making option B 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 (error)
Why it's wrong here
No error.
- ✓
A
Why this is correct
First condition met.
- ✗
B
Why it's wrong here
Elif not evaluated because first condition is true.
- ✗
C
Why it's wrong here
Else not reached.
Go deeper
Related to this question
About these practice questions
Courseiva writes every PCEP question from scratch — 498 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.