成人快手

Software development - EduqasProgramming errors

Translators like compilers, interpreters and assemblers are needed to translate programs written in high-level languages into the machine code that a computer understands. There are different stages in the compilation process. Tools exist to help programmers develop error-free code.

Part of Computer ScienceUnderstanding Computer Science

Programming errors

There are several types of error that can occur when writing programs:

  • /execution
  • linking
  • rounding
  • truncation

Syntax

A is an error in the rules of a sequence of characters that have been written in a particular . For example, there could be a missing speech mark or bracket, or a grammatical symbol such as a semicolon or equals sign may be included where it is not expected

Runtime/execution

These are errors that occur only during the execution of a program. Errors include running out of memory.

Logical

These occur when the program is running, specifically when there is a problem with the logic. This might be using the < symbol instead of the > symbol, or using AND instead of OR. Logical errors might not cause an error message or stop a program from running, so they can be hard to find.

Linking

A linking error occurs when a function or that is needed by the program cannot be found. This might be because it has not been imported or because a file has been moved.

Rounding

A rounding error is the difference between the number that is stored by a computer program and the actual number. are often limited in the number of decimal places that they can store so a rounding error might occur if a number needs to be cut short. An example of this is pi (蟺) being limited to 3.14 when it is rounded to two decimal places.

Truncation

Similar to a rounding error, a truncation error is when a large number is reduced to fit a data type. The difference between rounding and truncation is that truncation cuts off the extra decimal places without changing the final digit. For example, 5.369 rounded to two decimal places is 5.37, but when truncated to two decimal places it is 5.36.