FC0-U71 Software Development Concepts Practice Question
A junior developer is writing a program that must repeatedly ask the user for a password until the correct password is entered. The developer needs a programming construct that will keep running the same block of code while a condition remains true. Which programming concept should the developer use?
⚠ Common exam trap
It's easy for candidates to confuse a conditional statement, which chooses a path once, with a loop, which repeats a block while a condition remains true.
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
✓
A loop
The requirement is repetition based on a condition, which is the definition of a loop. A loop checks its condition and repeats the enclosed statements until the condition becomes false, so placing the password prompt inside a loop that continues while the password is incorrect achieves the desired behavior. Other constructs such as functions, variables, and conditional statements control structure or storage but do not inherently repeat code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
A conditional statement
Why it's wrong here
A conditional statement, such as an if statement, chooses between different branches of code based on a condition. It evaluates the condition only once each time execution reaches it. It can decide whether to display an error message, but it does not repeat the prompt by itself, so it cannot keep asking until the password is correct.
- ✗
A function
Why it's wrong here
A function is a named, reusable block of code that performs a task and may accept parameters and return a value. It does not by itself repeat execution; calling a function once runs it once. Without a loop or recursion inside or around it, a function cannot repeatedly prompt the user until a condition changes, so it does not satisfy the requirement.
- ✗
A variable
Why it's wrong here
A variable is a named storage location that holds a value which may change during program execution. It can store the entered password or a flag, but it does not control the flow of execution. Declaring a variable alone will not cause any block of code to run repeatedly, so it cannot implement the repeated prompting behavior described.
- ✓
A loop
Why this is correct
A loop is a control structure that repeats a block of code as long as a specified condition evaluates to true. In this scenario, the developer can place the password prompt inside the loop and use a condition such as 'password does not match' to keep asking until the correct value is entered, which is exactly the behavior required.
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 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.