49. Which translation method converts all source code into machine code for later execution?
Answer: A
Compiler
A compiler is a translation method that converts the entire source code of a program into machine code, which can then be executed later. This process allows for optimization and error checking before the program runs, making it distinct from other translation methods.
A) Compiler
This option is correct because a compiler translates all the source code into machine code as a complete unit, storing the executable file for future execution. This process enables the program to run efficiently on the hardware for which it was compiled.
B) Assembler
An assembler is designed to convert assembly language into machine code, but it operates at a lower level than a compiler. While it translates source code to machine code, it does not handle high-level programming constructs, making it unsuitable for the broader task described in the question.
C) Operating system
An operating system does not perform translation of source code into machine code. Instead, it manages hardware and software resources on a computer, providing an environment in which programs can run. Therefore, it is not a translation method and does not fit the criteria of the question.
D) Interpreter
An interpreter translates source code into machine code line by line during execution, rather than compiling the entire program beforehand. This method does not create a separate executable file and can result in slower performance compared to compiled code, making it the incorrect choice for the question.
Conclusion
The compiler is the definitive answer as it is specifically designed to convert all source code into machine code for later execution, enabling optimized performance. In contrast, the assembler translates lower-level code, the operating system manages resources without translating code, and the interpreter executes code line by line without creating a separate executable. Thus, only the compiler fulfills the criteria outlined in the question.