21. What translates and executes source code into machine language one line at a time?
Answer: C
Interpreter translates and executes source code into machine language one line at a time.
An interpreter is a type of software that directly executes instructions written in a programming or scripting language without requiring them to be compiled into machine language beforehand. This allows for immediate execution of code, line by line.
A) Assembler
An assembler translates assembly language, which is a low-level programming language, into machine language. While it performs translation, it does so for entire programs rather than line by line, making it incorrect for this question.
B) Operating system
An operating system is system software that manages computer hardware and software resources and provides services for computer programs. It does not translate or execute source code into machine language, making this option incorrect.
C) Interpreter
An interpreter directly translates and executes source code into machine language one line at a time, which is exactly what the question asks for. This makes it the correct answer, as it enables immediate code execution without prior compilation.
D) Compiler
A compiler translates the entire source code of a program into machine language before execution. Unlike an interpreter, it does not execute the code line by line, so it does not fit the description provided in the question.
Conclusion
The interpreter is definitively the correct answer because it specifically translates and executes code one line at a time, fulfilling the criteria outlined in the question. In contrast, both the assembler and compiler operate on entire blocks of code, and the operating system does not perform code translation or execution.