Courseiva

FC0-U71 Software Development Concepts Practice Question

A developer writes a function that calculates the average of a list of numbers. The function works correctly when the list contains values, but crashes when the list is empty. Which programming concept should the developer apply to handle the empty list case gracefully?

⚠ Common exam trap

The trap here is selecting recursion because it involves lists, overlooking that the real issue is an unhandled runtime error requiring exception handling.

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

✓

Exception handling

The function fails at runtime when the list is empty, likely due to division by zero. Exception handling lets the developer catch that error and define a graceful response, such as returning a default value or message. Recursion, inheritance, and polymorphism are unrelated to runtime error management and would not prevent the crash.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Inheritance

    Why it's wrong here

    Inheritance is an object-oriented concept where a class derives properties and methods from a parent class. It has no bearing on handling a runtime error caused by an empty list. Applying inheritance would not prevent the crash or provide a mechanism to detect the empty input, so it is irrelevant to the problem described.

  • ✗

    Polymorphism

    Why it's wrong here

    Polymorphism allows objects of different types to respond to the same method call, enabling flexible code design. However, it does not address runtime errors like dividing by zero when a list is empty. The developer needs a way to intercept or check the error condition, which polymorphism does not provide, making it an incorrect choice for this scenario.

  • ✗

    Recursion

    Why it's wrong here

    Recursion is a technique where a function calls itself to solve smaller subproblems. While recursion can process lists, it does not inherently handle an empty list without a base case that explicitly checks for it. Using recursion alone would not prevent the division-by-zero error; the developer still needs a guard or exception handling, so recursion is not the direct solution.

  • ✓

    Exception handling

    Why this is correct

    Exception handling allows the function to catch a division-by-zero or empty-list error and respond gracefully, such as returning zero or a message. Since the crash occurs at runtime when the list is empty, wrapping the calculation in a try-catch block directly addresses the failure and prevents the program from terminating unexpectedly, making it the appropriate concept here.

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 →

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.