Skip to content

CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Computer Hardware and Software

A company secretary asks a developer to explain the difference between a compiler and an interpreter. Which statement is correct?

A compiler translates the entire source program into machine code before execution, whereas an interpreter translates and executes the program statement by statement. The other options reverse these roles or wrongly limit each translator to assembly or machine language.

  1. AA compiler translates the whole source program into machine code before execution, while an interpreter translates and executes it statement by statementCorrect
  2. BAn interpreter translates the whole program into an object file before execution, while a compiler runs it line by line
  3. CBoth translate only one statement at a time, but a compiler stores the output in RAM
  4. DA compiler is used only for assembly language, while an interpreter is used only for machine language

Explanation

A compiler converts the entire source code into object/machine code in one pass before running, and reports errors after analysing the whole program. An interpreter reads, translates and executes one statement at a time. The second option reverses the two roles.

Did you get it right without looking?

One question tells you little. A timed set on Computer Hardware and Software shows your real accuracy, how long you take and where you lose marks.

More Computer Hardware and Software questions