Types Of Errors Flashcards
Syntax error
An error that occurs when a command does not follow the expected syntax of the language, e.g. when a keyword is incorrectly spelt.
Runtime/execution error
An error that causes a program to output an incorrect answer (that does not necessarily crash the program).
Linking error
An error that occurs when a programmer calls a function within a program and the correct library has not been linked to that program.
Rounding error
Rounding is when a number is approximated to nearest whole number/tenth/hundredth, etc.
Truncation error
Truncating is when a number is approximated to a whole number/tenth/hundredth, etc. nearer zero.
An example of a syntax error
Incorrect: IF A ADN B Then
Correct: IF A AND B Then
An example of a runtime error
Program requests more memory when none is available, so the program crashes.
An example of a logical error
An algorithm that calculates a person’s age from their date of birth, but ends up giving negative numbers.
An example of a linking error
When the square root function is used and the library that calculates the square root has not been linked to the program.
An example of a rounding error
34.5 rounded to nearest whole number is 35, an error of +0.5.
An example of a truncation error
34.9 truncated to whole number is 34, an error of –0.9.
Logical errors
An error that causes a program to output an incorrect answer (that does not necessarily crash the program).