24. What translates and executes source code into machine language one line at a time?

Answer: B

Explanation:

Interpreter translates and executes source code into machine language one line at a time.

An interpreter processes source code by translating it into machine language line by line, executing each line as it is translated. This allows for immediate execution of code, making it ideal for scripting and interactive programming environments.

A) Assembler

An assembler converts assembly language, which is a low-level programming language, into machine code, but it does so for entire blocks of code rather than line by line. Therefore, it does not fulfill the requirement of translating and executing source code one line at a time.

B) Interpreter

An interpreter is specifically designed to read and execute source code line by line, translating it into machine language as it runs. This characteristic distinguishes it from other tools like compilers, which translate entire programs before execution.

C) Operating system

An operating system manages computer hardware and software resources and provides services for computer programs. It does not translate or execute source code into machine language; hence, it is not relevant to the question.

D) Compiler

A compiler translates the entire source code of a program into machine language before execution, rather than translating and executing it line by line. This fundamental difference means that a compiler cannot be the correct answer to the question asked.

Conclusion

The interpreter is the only option that translates and executes source code into machine language one line at a time, making it the correct answer. In contrast, the assembler, operating system, and compiler each serve different functions that do not align with the specific requirement of the question.