5.7.25

Types of errors

Types of Errors

Syntax Errors

  • Definition: Errors that occur due to incorrect syntax in the code.
  • Examples: Missing or mismatched brackets, semicolons, or quotes.
  • Cause: Typically caught by compilers or interpreters.

Runtime Errors

  • Definition: Errors that occur during the execution of the program.
  • Examples: Division by zero, out-of-range values, null pointer exceptions.
  • Cause: Can be caused by unexpected user input, incorrect assumptions, or unexpected conditions.

Logic Errors

  • Definition: Errors that occur due to flaws in the program's logic.
  • Examples: Incorrect algorithm, incorrect calculation, or incorrect assumptions.
  • Cause: Can be caused by misunderstandings of the problem, incorrect design, or lack of testing.

Semantic Errors

  • Definition: Errors that occur due to incorrect meaning or interpretation of the code.
  • Examples: Using a variable before it's initialized, or using a function incorrectly.
  • Cause: Can be caused by misunderstandings of the language, incorrect assumptions, or lack of documentation.

No comments:

Post a Comment

Difference between File and Folder

10 Differences Between Files and Folders Definition: File: A collection of data or information stored on a computer. ...