FC0-U71 Software Development Concepts Practice Question
A junior developer is asked to write a program that reads a user's age and determines whether the user is eligible to vote. The program must compare the age to 18 and display one of two messages. Which programming construct is the most appropriate to use for this decision-making step?
⚠ Common exam trap
The trap here is assuming that any control-flow structure, such as a loop, can handle a two-outcome decision when only conditional branching compares a value and chooses between alternative actions.
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
✓
An if-else statement
The task requires selecting one of two outcomes based on whether the age meets a threshold, which is exactly what conditional branching provides. An if-else statement evaluates a Boolean expression and routes execution to the appropriate block. Loops, variable declarations, and function definitions support other concerns such as repetition, storage, and reuse, but none of them performs the required true-or-false decision.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
An if-else statement
Why this is correct
An if-else statement evaluates a condition and executes one block of code when the condition is true and another block when it is false. Here, the condition is age >= 18, so the if branch displays the eligible message and the else branch displays the not eligible message. This directly matches the two possible outcomes the developer must handle.
- ✗
A for loop
Why it's wrong here
A for loop repeats a block of code a specific number of times or iterates over a collection. It is used for repetition, not for choosing between two alternative actions based on a condition. Using a for loop here would not provide the branching logic needed to compare age to 18 and show different messages.
- ✗
A function definition
Why it's wrong here
A function definition groups reusable code under a name and can accept parameters, but by itself it does not branch on a condition. The decision logic still must exist inside the function, typically as an if-else statement. Defining a function alone would not implement the required comparison and two-message output.
- ✗
A variable declaration
Why it's wrong here
A variable declaration reserves storage and names a value, such as storing the user's age. It does not evaluate conditions or control which code path runs. While a variable would hold the age, it cannot by itself decide between two messages, so it does not satisfy the decision-making requirement.
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.