Sonzaschool
Back

O-Level · Form 2

Computer Science

Debug computer programs

about 6 minutes to read

Discussions
Topics in this sectionDemonstrate an understanding of basic principles of computer programming (using an appropriate structured programming language such as C, Python, etc.)7 topics

Debugging Computer Programs

Debugging is the process of finding and fixing errors (also called "bugs") in a computer program. When you write a program, it may not work correctly the first time. The errors prevent the program from running or produce wrong results. Debugging helps you identify why the program is not working and correct it so that the program runs as expected.

In programming, there are three main types of errors you will encounter:

  • Syntax errors: Mistakes in the rules of the language, like forgetting a semicolon or misspelling a keyword.
  • Logical errors: The program runs but gives wrong results because the logic or formula is incorrect.
  • Runtime errors: Errors that happen while the program is running, such as dividing by zero or accessing an invalid position in an array.

When you can debug programs confidently, you can write larger and more complex programs because you know how to find and fix problems on your own.


Question

Which debugging technique involves adding printf() statements to check variable values during program execution?

Sign in to submit your answer and have it count toward your mastery.

Sign in to practice

Tutor

Stuck? Ask me anything about this topic.

Sign in to ask the Sonza AI Tutor about this question.

Sign in to ask

Discussions

No questions yet

Sign in to ask
Loading discussions…