Which of the following error can a compiler check?
2022
Which of the following error can a compiler check?
- A.
Syntax Error
- B.
Logical Error
- C.
Both Logical Error and Syntax Error
- D.
None of the above
Attempted by 309 students.
Show answer & explanation
Correct answer: A
The compiler can detect syntax errors because they break the grammar rules of the programming language before the program is run. It cannot detect logical errors automatically, because logical errors depend on the meaning of the program and usually appear only when you run it and see wrong output.