easyMultiple Choice
FC0-U71 Practice Question: A developer writes a script to calculate the…
A developer writes a script to calculate the average of a list of numbers. The script uses a loop to sum the numbers and then divides by the count. Which programming concept does this represent?
⚠ Common exam trap
A common mix-up: candidates confuse 'sequence' (the general order of steps) with 'iteration' (the repeated execution of a block), especially since the script does follow a sequence of steps, but the key distinguishing concept is the loop that repeats the summing 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
✓
Iteration
The script uses a loop to repeatedly access each number in the list and add it to a running total. This repeated execution of a block of code (the loop body) is the defining characteristic of iteration. Iteration is the correct programming concept because the average calculation depends on cycling through a sequence of elements, which is exactly what a loop provides.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Iteration
Why this is correct
The loop repeatedly executes the summation step for each element in the list, which is iteration: repeating a block of statements over a collection. Dividing afterwards is arithmetic, but the loop-driven repetition is the concept being demonstrated.
- ✗
Selection
Why it's wrong here
Selection chooses between alternative paths via conditions such as if or switch; the script instead iterates every element unconditionally, so no branch is evaluated. It would be the answer if the script skipped or handled values differently based on a test.
- ✗
Recursion
Why it's wrong here
Recursion solves a problem by a function calling itself on a smaller subproblem; here iteration accumulates the sum directly with no self-call or base case. Recursion would be correct for traversing nested structures or computing factorials.
- ✗
Sequence
Why it's wrong here
Sequence is the ordered execution of statements, which every script exhibits, so it does not identify the concept the loop demonstrates. It would be the answer if the question asked how instructions execute in order rather than which construct repeats the summation.
Go deeper
Related to this question
About these practice questions
This FC0-U71 question is part of Courseiva's 988-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 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.