---
title: "Debugging and testing"
subject: "Computer Programming"
chapter: 2
key: "semester_1/computer_programming:debugging-testing"
source: https://www.bctengineer.com/q/semester_1/computer_programming/debugging-testing
site: BCT Engineering
---

# Debugging and testing

Computer Programming · Chapter 2: Problem solving using Computer

- Asked in: 2074 Chaitra, 2 marks
- Video: [Program Debugging in C/C++ | What is syntax, runtime and logical errors with example program](https://www.youtube.com/watch?v=SgvW-RlLMW4) — Learn Coding
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/debugging-testing
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-2

## Question

What is debugging and testing?

## Short answer

Testing finds errors by running a program with sample data. Debugging locates and corrects the cause of those errors using techniques like tracing, print statements, or a debugger.

## Answer

**Testing** is the process of running a program with sample input data to check whether it gives the expected output and to find the presence of errors. Test data should include normal, boundary and invalid values.

**Debugging** is the process of locating the cause of an error found during testing (or compilation) and correcting it. Techniques include reading the compiler messages, tracing the program by hand, inserting `printf` statements, and using a debugger with breakpoints.

Testing finds that an error exists; debugging finds where it is and removes it.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Testing
   A. locates and removes the cause of errors
   B. runs the program with sample data to check output and find errors
   C. translates the code
   D. writes documentation
   Answer: B. Testing detects errors. (Key point: Testing)

2. Debugging
   A. only detects that errors exist
   B. only compiles code
   C. locates the cause of an error and corrects it
   D. writes test data
   Answer: C. Debugging fixes. (Key point: Debugging)

3. Test data should include
   A. only normal values
   B. only invalid values
   C. no data
   D. normal, boundary and invalid values
   Answer: D. Varied data find more errors. (Key point: Test data)
