Introduction / Context:
Translators differ in how they turn source code into actions. Interpreters execute statements directly, while compilers produce target code first. This question tests your understanding of the interpreter's operational model.
Given Data / Assumptions:
- Source program is in a high-level language or bytecode.
- Goal: identify the tool that executes without first producing a standalone machine binary.
- Loader/linker functions are separate concerns.
Concept / Approach:
- Interpreter: reads, analyzes, and executes statements on the fly.
- Assembler: converts assembly to machine code.
- Compiler: generates object/executable code ahead of time.
- Loader: places code in memory and resolves references for execution.
Step-by-Step Solution:
Match definition to behavior: direct execution of source/bytecode → interpreter.Eliminate other roles based on their distinct outputs.
Verification / Alternative check:
Examples: CPython interprets bytecode; many shells interpret commands line-by-line.
Why Other Options Are Wrong:
- Assembler: assembly → machine code, not direct execution.
- Compiler: produces object/executable files.
- Loader: prepares binaries for execution; does not interpret source.
- None: Incorrect because option A exactly defines an interpreter.
Common Pitfalls:
- Confusing JIT (a hybrid compiling during execution) with classical interpretation—both are not the same as static compilation.
Final Answer:
A program that appears to execute a source program directly, as if it were machine language
Discussion & Comments