Which of the following error can a compiler check ?

Syntax error
Logical error
Both Losical and Svntax error —
Compiler cannot check errors .

The correct answer is (a) Syntax error.

A compiler is a program that checks the syntax of a computer program to make sure that it is written in a way that the computer can understand. A compiler can check for syntax errors, but it cannot check for logical errors. Logical errors are errors in the logic of the program, such as using the wrong variable or making a mathematical mistake.

Here is a brief explanation of each option:

(a) Syntax error: A syntax error is an error in the way that a program is written. For example, a syntax error might occur if a programmer forgets to close a parenthesis or if they use the wrong keyword.
(b) Logical error: A logical error is an error in the logic of a program. For example, a logical error might occur if a programmer uses the wrong variable or if they make a mathematical mistake.
(c) Both logical and syntax error: A compiler can check for syntax errors, but it cannot check for logical errors. Therefore, this option is incorrect.
(d) Compiler cannot check errors: This option is also incorrect. A compiler can check for syntax errors.

Exit mobile version