Advertisements
Advertisements
Question
Give two differences between Syntax error and Logical error.
Distinguish Between
Solution
S. No. | Syntax error | Logical error |
1. | Errors occur when programming principles or grammar are not followed correctly. | Errors occur when software logic is not planned correctly. |
2. | All syntax problems should be recognised and repaired. Otherwise, the software won't run. | The computer is not aware that an error has occurred. The software executes, but the output may be incorrect. |
3. | Example: x = a + b The above statement generates a syntax error due to a missing semicolon at the end. |
To print numbers from 1 to 10,
The code above contains a logical mistake as the intended output requires x <= 10.
|
shaalaa.com
Is there an error in this question or solution?