Which of the following error can a compiler check?

2022

Which of the following error can a compiler check?

  1. A.

    Syntax Error

  2. B.

    Logical Error

  3. C.

    Both Logical Error and Syntax Error

  4. 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.

Explore the full course: Niacl Ao It Specialist