24 Computer -- Programming Concepts and Logics

What is an error? What are the different types of error?

What is an error? What are the different types of error?

There may be several errors inside a program which stops program from being executed or giving the desired result known as a bug. This type of error in a program may arise by not following proper rules given by the programming language, due to poor problem analysis or maybe due to hardware failure. 




The different types of errors are: 

  1. Syntax error:

    the error which may arise due to not following proper rules or format given by the programming language. Every programming language have their own vocabulary, punctuation and structure. Programmers need to follow every detail while programming. This type of error can be detected by language processor such as compilers and interpreter. For e.g. In C, every statement should end with semi-colon at the end of the statement then the errors encounter is syntax error.



  2. Logical error: 

    Logic refers to idea or concept used to solve a specific problem. If the problem is poorly understood than it may hamper while solving the problem. The error that is encountered due to poorly developed logic is called logical error. This type of error is not detected by language processor. For example: In order to calculate simple interest, we use the formula I =(P*T*R)/100, if we write above mentioned formula, as I=P*T*R, then the error encounter is logical error.



  3. Runtime error: 

    When a program is running or executing, it is said to be runtime. Hence, the error that are encounters/found while program is being executed is known as runtime error. It is also not detected by language translator. For example: if there is insufficient memory space, peripheral device not turning on, etc.|



  4. Semantic error: 

    The errors that arise due to writing invalid program logic that produces incorrect results when the instructions are executed is semantic error. The syntax of the source code may be valid, but the algorithm being employed may not. Some semantic errors may also be classified under logic errors.



  5. Compile Time error: 

    Compilation errors are the most common errors occurred due to typing mistakes or if you don't follow the proper syntax of the specific programming language, These errors are thrown by the compilers and will prevent your program from running. These errors are most common to beginners and easy to debug. It can also be considered a type of Syntax Error.


More questions on Programming Concepts and Logics

Close Open App