PCEP Computer Programming and Python Fundamentals Practice Question
Exhibit
Refer to the exhibit. ``` x = '10' y = 5 result = x + y print(result) ```
What is the output of the code in the exhibit?
⚠ Common exam trap
Python Institute often tests the misconception that Python will automatically convert types (like JavaScript or PHP do), leading candidates to expect either concatenation or addition instead of recognizing that Python raises a TypeError for incompatible operand types.
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
✓
TypeError
The code attempts to concatenate a string ('10') and an integer (5) using the + operator. In Python, the + operator does not implicitly convert types; it raises a TypeError because it cannot determine whether to perform string concatenation or integer addition. This is a fundamental rule of Python's strong typing system.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
TypeError
Why this is correct
Cannot concatenate str and int.
- ✗
'105'
Why it's wrong here
No implicit conversion from int to str.
- ✗
105
Why it's wrong here
Not a string, but still requires conversion.
- ✗
15
Why it's wrong here
No implicit conversion from str to int.
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.