How is an interpreter different from a compiler?

a: An interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.
b: An interpreter translates all code at once so that it is ready to be executed at any time, while a compiler translates and executes code line by line.
c: An interpreter translates programming code into binary language, while a compiler does not.
d: An interpreter translates binary language into programming language, while a compiler translates programming language into binary language.

Respuesta :

Answer:

Option A is correct answer, which is, an interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.

Further Explanation

• Both, compiler and interpreter used to run program with few differences like interpreter executes line by line while compiler runs program at once.

• If there is no error in the program then compiler will convert source code into machine code which runs faster as compared to interpreters.

• Interpreters executes code run line by line if error occurs, it must be rectified before proceeding to next line while compilers runs whole code.

 Answer details  

Grade: Middle

Subject: Computers and Technology

Keywords: compiler, interpreter, code execution etc

Answer:

An interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.

Explanation:

Some other differences between the both are:

* An interpreter always translates the program one statement at a time while compiler scans the entire programs and converts it into machine code as a whole.

*Interpreters are efficient because no intermediate object is created while compilers generate intermediate object code which further requires linking.

*Interpreters do not save the machine code while compilers store the machine code on the disk.

Tags: difference between interpreter and compiler