Monday, September 16, 2013

TESTING AND DEBUGGING


TESTING AND DEBUGGING
      Computer programs are subject to errors as they are written by human being.
       Programs errors are known as bugs
What is DEBUGGING?
      The process of finding and removing errors in a computer program is known as debugging
What is TESTING?
      Testing is the process of making sure that the program performs the intended task
      Debugging is the process of finding and eliminating program errors.
      Testing and debugging are important steps in developing computer program.
Types of Errors
      There are two types of errors that occur in a computer program:
1.    Syntax errors
2.    Logical errors
1.  Syntax errors
      Syntax errors result when the rules or syntax/grammar of the programming languages are not followed.
      For example, the C statement c = (a+b/2 has a syntax error. In this example, the syntax error is a missing closing parenthesis.
      All language processors (compilers, interpreter & assemblers) 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.
      A single syntax error can causes multiple error messages.
2.  Logical Errors
      Logical error occurs when the logic of the program is incorrect and they are difficult to find and remove since they are not detected by the compiler. 
      Logical error is an error in planning the program’s logic
      In this case the language processor successfully translates the code into machine code.
       The computer actually doesn’t know that the error has been made.
      It follows the program instructions and outputs the incorrect results or stops during execution.
      The computer doesn’t tell what is wrong.
      For example, if a C instruction should be “a=b*c” but has been coded as “a=b+c”, this error will not be detected by the language processor since no language rules have been violated. However, the output produced will be wrong.


      In order to determine whether or not a logical error exists, the program must be tested. The purpose of testing is to determine whether the results are correct or not.

No comments:

Post a Comment