A compiler is used to convert the following to object code which can be executed
2009
A compiler is used to convert the following to object code which can be executed
Answer: A. High-level language — Concept — A processor can execute only instructions belonging to its own binary instruction set, so a program written in any other notation must first be…
- A.
High-level language
- B.
Low-level language
- C.
Assembly language
- D.
Natural language
Attempted by 99 students.
Show answer & explanation
Correct answer: A
Concept — A processor can execute only instructions belonging to its own binary instruction set, so a program written in any other notation must first be translated into that form. Systems software supplies a separate translator for each kind of source notation, and the stored machine-instruction file that a translator produces is called object code; a linker and a loader then turn object-code modules into a runnable program.
Application — The stem fixes the output as object code and the tool as a compiler, so the question is which source notation a compiler accepts. A compiler reads a complete source program written in a machine-independent high-level language such as C, C++ or FORTRAN, checks it through its analysis phases, and generates object code for its target machine before the program is run. The input that a compiler converts to object code is therefore a high-level language program.
The standard language-translator map:
Translator | Input | Output |
|---|---|---|
Compiler | High-level language program (C, C++, FORTRAN) | Object code for the target processor |
Assembler | Assembly language program (MOV, ADD mnemonics) | Object code for the target processor |
Interpreter | High-level language program | No stored object file; each statement is executed as it is read |
Linker and loader | Object-code modules | Executable program placed in memory |
Cross-check — The other three notations do not sit at a compiler's input:
Assembly language is turned into object code by an assembler, whose mapping is one mnemonic to one machine instruction; a compiler is not defined for it.
Low-level language covers machine code, which is already in the binary instruction form the processor decodes directly, so it is the target of translation rather than the source.
Natural language such as English or Hindi has a context-dependent, ambiguous grammar and no fixed formal syntax, so no standard translator produces object code from it.
Result — A compiler converts a high-level language program into object code.