easyMultiple ChoiceObjective-mapped
FC0-U71 Practice Question: A developer writes the following pseudocode: for…
A developer writes the following pseudocode: for i = 1 to 5, sum = sum + i. What does this code do?
⚠ Common exam trap
Candidates often confuse the loop's iteration with a single addition of the final value (5) or mistakenly think the code prints output, when in fact the pseudocode only performs a cumulative addition without any display operation.
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
✓
It sums the numbers from 1 to 5
The pseudocode initializes a loop that iterates with i taking values 1, 2, 3, 4, and 5. In each iteration, the current value of i is added to the variable sum. After the loop completes, sum holds the total of 1+2+3+4+5, which is 15. This is a standard accumulator pattern used in programming to compute a running total.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
It sums the numbers from 1 to 5
Why this is correct
The loop iterates through 1 to 5 and accumulates the sum.
- ✗
It adds 5 to the sum
Why it's wrong here
The loop runs multiple times, not just once.
- ✗
It multiplies numbers from 1 to 5
Why it's wrong here
The operator is '+', not '*'.
- ✗
It prints the numbers from 1 to 5
Why it's wrong here
No output statement is shown.
Go deeper
Related to this question
About these practice questions
One of 988 original FC0-U71 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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This FC0-U71 practice question is part of Courseiva's free CompTIA 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 FC0-U71 exam.