In systems programming, which translator converts assembly language source code into executable machine code for a specific processor architecture?
-
ACompiler
-
BInterpreter
-
CAssembler
-
DComparator
-
ENone of the above
Answer
Correct Answer: Assembler
Explanation
Introduction / Context:Low-level programming often uses assembly language, a human-readable notation closely tied to a CPU's instruction set. Turning this assembly into machine code requires the correct type of translator. Knowing whether a compiler, interpreter, or assembler is used is a fundamental software engineering concept.
Given Data / Assumptions:
- Input language: assembly language (mnemonics like MOV, ADD, JMP).
- Target: machine code (binary opcodes and operands for the specific CPU).
- We need the translator that maps mnemonics and addressing modes directly to opcodes.
Concept / Approach:An assembler reads symbolic assembly language and produces object code (machine code) by converting mnemonics to opcodes and resolving labels to addresses. A compiler targets machine code from high-level languages, and an interpreter executes code line by line without producing a standalone binary in the same way. A comparator is unrelated to translation; it compares data or files.
Step-by-Step Solution:Identify the source: assembly language.Match tool to task: assembly → assembler (not compiler/interpreter).Assembler outputs machine code and may generate listing and symbol tables.Therefore, the correct translator is the assembler.
Verification / Alternative check:Toolchains typically run: assembler → linker → loader for assembly projects. High-level projects instead use compilers before linking. This pipeline confirms that assembly requires an assembler stage.
Why Other Options Are Wrong:
- Compiler: Translates high-level languages (e.g., C, Pascal) to machine code.
- Interpreter: Executes source statements directly or via bytecode, not pure assembly to binary.
- Comparator: Not a translator; used for comparisons.
- None of the above: Incorrect because assembler is exactly right.
Common Pitfalls:Assuming compilers handle assembly too; while some compilers accept inline assembly, assembling proper source files remains the assembler's role.
Final Answer:Assembler