If the results generate for the test data do not

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s, and the process of detecting and correcting these errors is called debugging. In general, testing is the process of making sure that the program performs the intended task, and debugging is the process of locating and eliminating program errors. Testing and debugging are important steps in program development. They are also timeconsuming steps. In fact, for large programs, the time spent in testing and debugging often exceeds the time spent in coding the program. Types of Program Errors In general, there are two types of errors that occur in a computer program - syntax errors and logic errors. They are briefly described below. Syntax Errors Syntax errors result when the rules or syntax of the programming language are not followed. Such program errors typically involve incorrect punctuation, incorrect word sequence, undefined terms, or misuse of terms. For example, the FORTRAN statement C = (A + B/2 has a syntax error because of the missing closing parenthesis which should be placed in the appropriate place depending on the logic of the program. All syntax errors in a program must be found and corrected before it will run. That is, a program cannot be successfully compiled and executed until all its syntax errors have been corrected. Logic Errors A logic error is an error in planning the program's logic. Such errors cause the program to produce incorrect output. That is, a program which is free of syntax errors but has one or more logic errors will be successfully compiled and executed but will not produce correct output. The problem is that since the program contains logic errors, the logic being followed during its execution will not be correct and hence the program will not produce the desired results. For example, if a FORTRAN instruction should be "A = B + C" but has been coded as "A = E - C", it is an example of a logic error because the output produced by the program will not be correct. Testing a Program In case of a logic error, since no...
View Full Document

Ask a homework question - tutors are online