18. Which translation method converts all source code into machine code for later execution?

Answer: C

Explanation:

Compiler

A compiler is a translation method that converts all source code into machine code, allowing it to be executed at a later time. This process produces an executable file that can be run independently of the original source code.

A) Operating system

An operating system is not a translation method; rather, it is system software that manages computer hardware and software resources and provides services for computer programs. It does not convert source code to machine code but rather provides an environment for executing programs.

B) Interpreter

An interpreter translates source code into machine code line-by-line during execution rather than producing a complete machine code file beforehand. This means that it does not fulfill the requirement of converting all source code for later execution as a compiler does.

C) Compiler

A compiler translates the entire source code into machine code prior to execution, creating an executable file. This method allows the program to run independently of the source code, which is the key characteristic being asked in the question.

D) Assembler

An assembler translates assembly language into machine code but operates at a lower level than a compiler, which handles higher-level programming languages. While it does convert code into machine code, it does not encompass the broader range of languages that a compiler does, nor does it handle the entire source code in the same way.

Conclusion

The compiler is the definitive answer as it uniquely converts all source code into a standalone machine code file for future execution, distinguishing it from the other options. The operating system and interpreter serve different functions, and while assemblers also convert code, they do not manage high-level programming languages in the same way as compilers.