PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A script runs:
x = 5 y = x y += 3
print(x, y)
What is printed?
⚠ Common exam trap
The trap here is believing that assigning one variable to another creates a permanent link, so changing one automatically changes the other.
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
✓
5 8
Names in Python are references to objects, and integers are immutable. Assigning y = x makes both names point to the same 5 object, but y += 3 creates a new integer and rebinds only y. Since x is never reassigned, it continues to reference 5, and the output is 5 8.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
5 8
Why this is correct
After y = x, both names refer to the same integer object with value 5. The statement y += 3 computes 5 + 3 and rebinds y to a new integer object with value 8, but it does not modify the original object, which integers cannot do. The name x still references 5, so the script prints 5 8.
- ✗
5 5
Why it's wrong here
This option treats y += 3 as having no effect, as if augmented assignment only reads the value. The += operator is equivalent to y = y + 3, so it definitely rebinds y to the sum. While x remains 5, y becomes 8, so the second printed value should be 8 rather than 5, making this pair wrong.
- ✗
8 5
Why it's wrong here
This option reverses which name receives the new value. The augmented assignment targets y, the name on the left of the operator, so y becomes 8 while x stays 5. Printing x first would then show 5, not 8. The order in the print call is x then y, so this reversed pair contradicts the actual rebinding.
- ✗
8 8
Why it's wrong here
This option assumes that assigning y = x links the two names so a later change to one affects the other. For immutable integers, each name holds a reference to a value, and augmented assignment rebinds the name on the left to a new integer object. Rebinding y leaves x untouched, so printing x still shows 5, not 8, making this pair incorrect.
Go deeper
Related to this question
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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
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.