There are 3 types of common programming errors:

  • Syntax errors
  • Logical errors
  • Execution errors

 1) Syntax Errors: When a rule of programming language is violated syntax error occurs. The compiler can detect the syntax error and print appropriate error massage along with the line number. Syntax errors are easy to correct and they generally occur due to spelling mistakes, typing mistake, missing comma etc.

 2) Logical Errors: They are due to mistakes in solving the problem. The order of instruction may be wrong or the method of solution may be wrong.

The Compiler will not detect the logical errors or print any error message for it. Compiler will display the message “No error”, but after running the program the results are wrong. This is because of Logical error/s.

Logical errors are very difficult to predict. To correct the logical errors you should go through the algorithm, flowcharts or even through the method of solution.

Logical errors are detected by running the program for some sample input data for which the results are already known. If the results are wrong, debugging statements can be added in the program and we can print the intermediate results of processing and can determine at exactly which statement the program is going wrong. If the planning of method of solution, at early stages, is done carefully then logical errors can be eliminated.

 3) Execution Error:  These errors occur when you try to run a program that contents statement impossible to execute. e.g. Division by 0, Square root of negative number etc.

When the input data is incorrect or if the input is given in wrong order then execution error occurs.

Execution error may also occur if there is any error in the language translator or in the operating system. In this case you should reload the operating system or compiler form the original disk. But this happens very rarely.

Distinguish between the debugging and testing.

Testing: Basically, testing is a process of exploring the system to find defects present in the software, and not only that, this process has to locate the defects and define what will happen once these defects occur. This process is performed in the testing phase by testing team, and after this phase, they will report to the developer team to debug.

Debugging: Once Development team received the report from the testing team, they will start debugging. The purpose of this phase is to locate the bug and rids the software of it. It is a one-off process and is done manually. In this process, a special tool called debugger is used in locating the bugs, most of the programming environments have the debugger.

Testing

Debugging

The purpose of testing is to find bugs and errors.

The purpose of debugging is to correct those bugs found during testing.

Testing is done by tester.

Debugging is done by programmer or developer.

It can be automated.

It can’t be automated.

It can be done by outsider like client.

It must be done only by insider i.e. programmer.

Most of the testing can be done without design knowledge.

Debugging can’t be done without proper design knowledge