Computer programs are subject to errors as they are written by human beings. Program errors are known as bugs and the process of detaching and correcting the errors is called debugging. In general, testing is the process of making sure that the program performs the intended task and debugging in the process of finding and eliminating program errors. Testing and debugging are important steps in developing computer programs.
In general, there are two types of errors that occur in a computer program, there are:
In general, there are two types of errors that occur in a computer program, there are:
- Syntax Errors.
- Logical Errors.
Syntax Errors:
Syntax errors result when the rules or syntax of the programming languages are not followed. For example, the C statement c=(w +a/4) have a syntax error. In this example, the syntax error is a missing closing parenthesis.
Almost all language processors are designed to detect syntax errors. The language processors print error messages that indicate the number of the statement having error and give hints about the nature of the error. These error messages are very useful and are used by the programmers to rectify the syntax errors in the programs. Thus, it is relatively easy task to detect and correct syntax errors. It should be noted that is high-level languages, such as Fortran, Cobol, etc, a single syntax error often causes multiple error messages.
Logical Errors:
The second type of error, a logical error is an error in planning the program’s logic. In this case the language processor successfully translates the source code into machine code. The computer actually does not know that an error has been made. It follows the program instructions and outputs the incorrect results or stops during execution.
The computer does not tell you what is wrong. For example, if a C instruction should be “x=y*a” but has been coded as “x=y+a”, this error will not be detected by the language processor since no language rules have been broken.
In order to determine where or not a logical error exists, the program must be tested. The purpose of testing is to determine where the results are correct or not. The resting procedure involves running the program to process input test data that will produce known result.
Post a Comment