mediumMultiple ChoiceObjective-mapped
FC0-U71 Practice Question: A developer is troubleshooting a program that…
A developer is troubleshooting a program that produces unexpected results. The code includes a loop that repeats 10 times but the output shows only 9 values. Which debugging step should be taken first?
⚠ Common exam trap
The trap here is that candidates often jump to adding print statements (Option A) as a reflexive debugging action, but the CompTIA FC0-U61 exam emphasizes systematic troubleshooting—starting with code review of the loop's control logic before adding output or making invasive changes.
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
✓
Check the loop condition and initial value
The loop produces 9 outputs instead of 10, indicating the loop body executes one fewer time than intended. The first debugging step should be to examine the loop condition and initial value, as this directly controls how many iterations occur. For example, if the loop initializes at 1 and runs while `i < 10`, it will iterate 9 times (1 through 9), not 10. Checking these values immediately identifies off-by-one errors without adding unnecessary complexity.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add a print statement inside the loop
Why it's wrong here
Useful, but checking the condition is a more systematic first step.
- ✓
Check the loop condition and initial value
Why this is correct
A wrong condition or initialization can cause off-by-one errors.
- ✗
Reinstall the programming environment
Why it's wrong here
This is an extreme measure unlikely to fix logic errors.
- ✗
Comment out all lines except the loop
Why it's wrong here
This may remove the symptom but not find the root cause.
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.