Which one of the following is not a language translator ?
- (a)Assembler
- (b)Linker
- (c)Interpreter
- (d)Compiler
Answer
Why
Correct — B, (b) Linker. A language translator is a program whose job is to convert a program written in one language into another — in practice, from a form a human can write into a form the machine can run. Three kinds are standard, and three of the four options are exactly those three: an assembler translates assembly language into machine code, a compiler translates a high-level language into object or machine code, and an interpreter translates and executes a high-level program one statement at a time. The linker is the odd one out because nothing is translated by it. It runs after translation has already happened. Its input is the object modules a compiler or assembler has produced, together with the library routines the program calls, and its output is a single executable file. What it actually does is resolve external references — matching each call to a function defined in another module or in a library to the address where that function's code sits — and relocate addresses so that the combined modules occupy one consistent address space. The language on the way in and the language on the way out are the same. Linking may be static, with library code copied into the executable at build time, or dynamic, with the reference left to be resolved from a shared library when the program is loaded or run. The linker is usually taught alongside the loader, which is also not a translator: the loader takes the executable, places it in main memory, sets up its addresses and hands control to it. Assembler, compiler, interpreter, linker, loader is the standard sequence, and only the first three of them translate anything.
Why the others are wrong
- (a)Assembler — The plainest translator of the four. An assembler converts assembly language — the symbolic mnemonics of a particular processor, such as MOV, ADD or JMP, with labels standing in for addresses — into the binary machine code that the processor executes, largely one instruction for one instruction. Most assemblers work in two passes: the first builds a symbol table recording the address each label stands for, and the second emits the code with those addresses filled in. The reverse program, which reconstructs assembly language from machine code, is the disassembler.
- (c)Interpreter — An interpreter is a translator that never saves its work. It takes the source program one statement at a time, translates that statement, executes it, and moves on, so no separate object file is produced and the translation is repeated every time the program is run. That makes an interpreted program slower on repeated execution but easier to debug, because execution stops at the first error and reports it in place. Compilation and interpretation are ends of a spectrum rather than a strict either-or — several modern languages compile to an intermediate bytecode which is then interpreted or just-in-time compiled — but an interpreter is unquestionably translating.
- (d)Compiler — The translator most candidates name first. A compiler reads the entire high-level source program, checks it, and produces object code for the whole of it in one exercise, reporting all the errors it finds rather than halting at the first. Its work is conventionally divided into phases: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimisation and code generation. Its output — object modules — is precisely what the linker then takes as input, which is why the two are so often confused; but the compiler changes the language and the linker does not.
Concept
System software sits between the programs people write and the hardware that runs them, and its components are best learnt as a pipeline. A programmer writes source code in a high-level language or in assembly. A translator converts that source into machine code: an assembler for assembly language, a compiler for a high-level language, an interpreter for a high-level language it also executes as it goes. Compilation typically yields object modules that are not yet runnable — they contain gaps where calls to routines defined elsewhere will go. The linker fills those gaps, joining the object modules to one another and to the library routines they use, resolving external references and relocating addresses to produce a single executable. The loader then copies that executable into main memory and starts it. Around this core sit tools that are also not translators: the preprocessor, which handles textual substitutions and file inclusion before compilation; the debugger; and the editor. Two special cases are worth carrying: a cross-compiler produces code for a processor other than the one it runs on, which is how software for phones and embedded devices is built, and a decompiler attempts the reverse of compilation. The question tests whether the pipeline is understood as stages with different jobs rather than as a list of names that all have something to do with turning source code into a running program.
The computer blocks on this paper are single-fact recall of first-year systems vocabulary, and the Commission's favourite construction is to put three members of a class beside one near neighbour that belongs to a different stage of the same pipeline. Reading the ask exactly is what saves the answer here: the word 'not' is printed in bold italic, and a candidate who reads the question as 'which of these is part of building a program' will find all four qualify. The habit worth building is to name the input and the output of each tool. Assembler, compiler and interpreter all take a program in one language and give back a program in another; the linker takes object code and gives back object code, and the loader takes an executable and gives back a running process.
Key facts
- A language translator converts a program from one language to another; the three standard translators are the assembler, the compiler and the interpreter.
- An assembler translates assembly language mnemonics into machine code, usually in two passes, building a symbol table of labels and their addresses in the first.
- A compiler translates an entire high-level source program into object code in one exercise and reports all the errors it finds; its phases run from lexical analysis to code generation.
- An interpreter translates and executes a source program statement by statement, produces no object file, and halts at the first error.
- A linker joins object modules produced by a compiler or assembler with the library routines they call, resolves external references and relocates addresses to produce one executable.
- Linking may be static, with library code copied into the executable, or dynamic, with the reference resolved from a shared library at load time or run time.
- A loader places an executable in main memory and transfers control to it; like the linker, it translates nothing.
- A cross-compiler generates code for a processor other than the one it runs on; a disassembler recovers assembly language from machine code and a decompiler attempts to recover source code.
- SOURCE CODE — the programmer writes in a high-level language, or in assembly.
- ASSEMBLER — translates assembly language, the symbolic mnemonics of a particular processor such as MOV, ADD or JMP with labels standing in for addresses, into binary machine code, largely one instruction for one instruction. Most assemblers work in two passes: the first builds a symbol table recording the address each label stands for, the second emits the code.
- COMPILER — reads the entire high-level source program, checks it, and produces object code for the whole of it in one exercise, reporting all the errors it finds rather than halting at the first. Its phases run lexical analysis, syntax analysis, semantic analysis, intermediate code generation, optimisation and code generation. An INTERPRETER is the alternative translator: it takes one statement at a time, translates it, executes it and moves on, saving no object file and stopping at the first error.
- LINKER — the odd one out, because nothing is translated here. Its input is the object modules a compiler or assembler has produced, together with the library routines the program calls; its output is a single executable file. What it does is resolve external references — matching each call to a function defined in another module or a library to the address where that function’s code sits — and relocate addresses so that the combined modules occupy one consistent address space. The language on the way in and the language on the way out are the same.
- LOADER — takes the executable, places it in main memory, sets up its addresses and hands control to it. Like the linker, it translates nothing.
- Two special cases worth carrying — linking may be STATIC, with library code copied into the executable at build time, or DYNAMIC, with the reference left to be resolved from a shared library when the program is loaded or run. And a CROSS-COMPILER produces code for a processor other than the one it runs on, which is how software for phones and embedded devices is built.
Study next
Common traps
- Reading a bold-italic 'not' as if it were not there. Three of these four options are translators, so the ask is which one is not.
- Treating the linker as a kind of compiler because it runs as part of building a program. It transforms addresses, not language.
- Confusing the linker with the loader. The linker builds the executable; the loader puts it in memory and starts it.
- Assuming an interpreter does not translate at all because it produces no object file. It translates each statement, then executes it.
- Assuming a compiled program is always faster than an interpreted one in every respect; compilation costs time up front and just-in-time compilation blurs the distinction.
EPFO's computer blocks stay at the level of a first-year systems course and repeat a small set of themes: what a named piece of system software does, the memory hierarchy, units of storage, input and output devices, networking basics and file formats. The recurring construction is a class of three with one intruder, phrased negatively. Prepare by fixing the job of each named tool in one sentence — what goes in and what comes out — rather than by memorising definitions, because the options are usually one word long and give nothing to reason from.
Related PYQs
EPFO_EOAO_2020_Q67Open & attempt →Which one of the following statements is correct ? A device driver of output devices
- (a) interprets input provided by users into computer usable form.
- (b) interprets computer output into user understandable form.
- (c) translates user inputs into output device.
- (d) facilitates user to communicate with output device.
Answer(b) interprets computer output into user understandable form.
The next item of the same computer block, on what a device driver for an output device does — another piece of system software that is not a translator.
EPFO_EOAO_2020_Q29Open & attempt →Which one of the following is not a web browser ?
- (a) Internet Explorer
- (b) Firefox
- (c) Fedora
- (d) Google Chrome
Answer(c) Fedora
The same construction earlier in the paper: three members of a class and one intruder, asking which is not a web browser.
EPFO_EOAO_2020_Q27Open & attempt →Which one of the following basic operations for converting raw input data into useful information is not performed by all computers ?
- (a) Inputting
- (b) Storing
- (c) Switching
- (d) Outputting
Answer(c) Switching
Tests the other half of the computing vocabulary — the basic operations by which raw input data becomes useful information.
Practice
- practice — not a real PYQ
Which one of the following combines object modules with library routines and resolves external references to produce a single executable file ?
- (a)Compiler
- (b)Linker
- (c)Interpreter
- (d)Assembler
Answer(b) Linker
- practice — not a real PYQ
Which one of the following translates a high-level language program statement by statement and produces no separate object file ?
- (a)Compiler
- (b)Assembler
- (c)Interpreter
- (d)Loader
Answer(c) Interpreter