Courseiva
mediumMultiple ChoiceObjective-mapped

FC0-U71 Practice Question: Given the following pseudocode that calculates…

Given the following pseudocode that calculates the average of a list of numbers, which error will occur?

SET total = 0 SET count = 0 FOR EACH number IN list total = total + number count = count + 1 ENDFOR SET average = total / count OUTPUT average

⚠ Common exam trap

The key distinction is that this code runs correctly for non-empty lists but fails at runtime when the list is empty. This tests the difference between syntax/logic errors and runtime errors that occur under specific conditions.

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

Runtime error

The pseudocode computes an average by dividing `total` by `count`. If the list is empty, `count` remains 0, and division by zero is a runtime error. This error occurs during execution, not during compilation or syntax checking, and is not a logic error because the code is logically correct for non-empty lists.

Answer analysis

Option-by-option breakdown

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

  • Compile-time error

    Why it's wrong here

    Pseudocode is not compiled, so compile-time error does not apply.

  • Logic error

    Why it's wrong here

    A logic error would produce incorrect output, but division by zero causes a runtime error before output.

  • Syntax error

    Why it's wrong here

    The pseudocode syntax is correct; no syntax error.

  • Runtime error

    Why this is correct

    If the list is empty, division by zero causes a runtime error.

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 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.