Courseiva
hardMultiple Select

How to Debug an IndexError in Python

A developer is debugging a program that is producing incorrect output. Which of the following are common debugging techniques? (Choose three.)

⚠ Common exam trap

The trap is including remediation or scope-change actions (reinstall OS, change requirements) as 'debugging' — the exam tests whether you distinguish diagnosis techniques from fixes or requirement changes.

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

✓

Using a debugger

Using a debugger (A) is a core debugging technique because it lets the developer set breakpoints, step through execution line by line, inspect variables and the call stack, and observe the program's state at the exact point where output diverges from expectations. Code review (B) is also a common debugging technique: a careful reading of the source, often by a second developer, can reveal logic errors, off-by-one mistakes, incorrect conditionals, or misuse of APIs that cause incorrect output. Adding print statements (C) is a classic and widely used technique, inserting temporary logging at key points to trace variable values and control flow and thereby localize the faulty logic. Reinstalling the operating system (D) is not a debugging technique for a program producing wrong output; it is a drastic system-recovery action that would not address a logic or coding defect. Changing the program requirements (E) is not debugging either, since debugging means finding and fixing the defect in the code, not redefining what the program is supposed to do.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Using a debugger

    Why this is correct

    A debugger lets the developer pause execution, inspect variable values and step through code line by line, directly exposing where logic diverges from intent. This satisfies the need to locate the cause of incorrect output rather than merely observing symptoms.

  • ✓

    Code review

    Why this is correct

    Code review brings a second pair of eyes to inspect logic, spot faulty assumptions and catch defects the author overlooks. Applied to a program producing incorrect output, it identifies the flawed reasoning behind the wrong result, satisfying the debugging technique requirement.

  • ✓

    Adding print statements

    Why this is correct

    Print statements output variable values and execution checkpoints at chosen points, revealing where actual behaviour diverges from expected. This traces the faulty logic causing incorrect output, satisfying the requirement for a practical debugging technique without specialised tooling.

  • ✗

    Reinstalling the operating system

    Why it's wrong here

    Reinstalling the operating system destroys the environment rather than isolating the faulty logic, so it cannot reveal where output diverges. It is tempting as a generic remedy for corrupted system state, and would be justified when the OS itself is unstable or infected, not when code produces wrong results.

  • ✗

    Changing the program requirements

    Why it's wrong here

    Changing requirements alters what the program should do, not how you locate the defect, so it is not a debugging technique. It belongs to requirements gathering or scope negotiation, where stakeholders revise specifications before development begins.

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.