Courseiva
easyMultiple ChoiceObjective-mapped

FC0-U71 Practice Question: A junior developer is tasked with creating a…

A junior developer is tasked with creating a function that checks whether a number is even or odd. The developer writes the following pseudocode: FUNCTION isEven(number) IF number % 2 == 0 THEN RETURN true ELSE RETURN false. The developer then realizes they need to handle non-integer input. Which of the following should the developer add to improve the robustness of this function?

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

Add input validation to check if the number is an integer.

Adding input validation to check if the number is an integer ensures the modulus operation works correctly. A parameter for number type is not standard. Changing the operator would break the logic. Deleting and using a library is overkill.

Answer analysis

Option-by-option breakdown

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

  • Add input validation to check if the number is an integer.

    Why this is correct

    Validation ensures only integers are processed, preventing errors.

  • Delete the function and use a built-in library instead.

    Why it's wrong here

    Built-in libraries may not exist for this simple check, and deleting the function is unnecessary.

  • Change the modulus operator to a division operator.

    Why it's wrong here

    Division does not check parity; it changes the function's purpose.

  • Add a parameter for the number type.

    Why it's wrong here

    Parameters define input, not validation; it doesn't prevent non-integer input.

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