PCEP Practice Question: Data Types, Variables, Basic I/O and Operators
A developer writes a script to track inventory:
apples = 15 oranges = 4 apples -= oranges oranges += apples
print(apples, oranges)
What is printed?
⚠ Common exam trap
The trap here is assuming that the second augmented assignment uses the original value of apples rather than the value after the first assignment has already executed.
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
✓
11 15
Augmented assignment operators like -= and += modify the variable in place and take effect immediately. After apples -= oranges, apples is 11. The next line adds that new apples value to oranges, making oranges 15. The printed output reflects these sequential updates, so the correct pair is 11 and 15.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
11 4
Why it's wrong here
This would be the result if the second augmented assignment were ignored or if oranges were not updated. The code does execute oranges += apples, so oranges changes from 4 to 15. The first value 11 is correct, but the second is not, so this pair does not match the actual output.
- ✗
19 4
Why it's wrong here
This would occur if apples -= oranges were mistakenly treated as addition, making apples 19. But the -= operator subtracts, so apples becomes 11, not 19. The second value would also change because oranges += apples uses the updated apples, so this pair is doubly wrong.
- ✓
11 15
Why this is correct
The statement apples -= oranges subtracts 4 from 15, leaving apples as 11. Then oranges += apples adds the updated apples value (11) to oranges (4), giving 15. The print call outputs 11 and 15 in that order. This demonstrates that augmented assignment updates the variable immediately before the next statement executes.
- ✗
11 19
Why it's wrong here
Here apples is correctly 11, but oranges would be 19 only if the original apples value (15) were added to 4, which is not what happens. The statement oranges += apples uses the current value of apples after the subtraction, which is 11, so oranges becomes 15, not 19.
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.