Multiple choice

A programmer, by mistake, writes an instruction 'divide' instead of 'multiply'. Which of the following will detect such kind of error?

  1. Interpreter

  2. Compiler

  3. Compiler or interpreter test

  4. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A compiler performs static analysis during the compilation phase, examining source code for syntax and semantic errors before generating machine code. If a programmer mistakenly writes 'divide' instead of 'multiply', the compiler's semantic analysis phase will detect this as a potential logical or type mismatch error during compilation, preventing the erroneous code from executing.