Courseiva

FC0-U71 Applications and Software Practice Question

A developer is writing a script in Python that processes user input. The script needs to execute a block of code repeatedly while a condition is true. Which programming construct should the developer use?

⚠ Common exam trap

Many candidates confuse iteration over a known sequence (for) with condition-driven repetition (while); candidates often pick for because it is the more familiar looping construct.

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

✓

while loop

A while loop is the correct construct because it repeatedly executes a block of code as long as a specified condition remains true, re-evaluating the condition before each iteration. This matches the requirement of executing code 'while a condition is true.' The for loop is designed for iterating over a known sequence or range, not for condition-driven repetition.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    for loop

    Why it's wrong here

    A for loop iterates over a sequence or fixed range, so it cannot repeat until a condition becomes false. It is tempting because for loops do repeat code, and one would be correct if the script needed to process each item in a known collection rather than loop on a condition.

  • ✓

    while loop

    Why this is correct

    A while loop repeats a block as long as its condition remains true, re-evaluating before each iteration. This directly satisfies the stated need to execute code repeatedly while a condition holds, unlike a for loop, which iterates over a sequence.

  • ✗

    function

    Why it's wrong here

    A function groups reusable code but does not itself repeat execution; it runs once per call. It is tempting because functions organise repeated logic, and defining one would be correct if the developer wanted to encapsulate the loop body for reuse elsewhere in the script.

  • ✗

    if/else

    Why it's wrong here

    An if/else statement branches once based on a condition and does not iterate. It is tempting because it evaluates a condition, and it would be correct if the script needed to choose between alternative actions rather than repeatedly execute a block while the condition stays true.

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 →

How Courseiva writes practice questions · Editorial policy

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 CompTIA exam blueprint

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.