Computer Science
Differentiate between a syntax error and a logical error in a python program. When is each type of error likely to be found?
Answer
Syntax Error | Logical Error |
---|---|
Syntax Errors occur when we violate the rules of writing the statements of the programming language. | Logical Errors occur due to our mistakes in programming logic. |
Program fails to compile and execute. | Program compiles and executes but doesn't give the desired output. |
Syntax Errors are caught by the compiler. | Logical errors need to be found and corrected by people working on the program. |
Syntax errors are found at compile type whereas Logical errors are found when the program starts executing.
Related Questions
Correct any false statements:
(a) Compile-time errors are usually easier to detect and to correct than run-time errors.
(b) Logically errors can usually be detected by the compiler.
What is the difference between an error and exception?
What are main error types? Which types are most dangerous and why?
Differentiate between a syntax error and a semantics error.