41. What translates and executes source code into machine language one line at a time?
Answer: B
Interpreter translates and executes source code into machine language one line at a time.
An interpreter processes source code by translating and executing it line by line, allowing for immediate execution of commands without producing a separate machine code file.
A) Compiler
A compiler translates the entire source code into machine language before execution, generating an output file. This differs from an interpreter, which executes code on-the-fly, making the compiler an incorrect choice for this question.
B) Interpreter
An interpreter directly translates and executes source code line by line, making it the correct answer. This approach allows for interactive debugging and immediate feedback, distinguishing it from other options.
C) Operating system
An operating system manages hardware and software resources on a computer but does not specifically translate or execute source code. Hence, this option does not fit the criteria of the question.
D) Assembler
An assembler translates assembly language into machine language, but it does so for the entire program at once rather than line by line. Therefore, it does not meet the question's requirements and is incorrect.
Conclusion
The interpreter is the only option that directly translates and executes source code one line at a time, which is essential for tasks like scripting and debugging. All other options either perform different functions or execute code in a manner that does not align with the definition provided.