Cross-Compiler vs Optimizing / Single-Pass / Multi-Pass: Correct Choice
You are asked:
“A compiler for a high-level language that runs on one machine and produce code for different machines is called”
(i) optimizing compiler
(ii) one-pass compiler
(iii) cross-compiler
(iv) multipass compiler
The correct option is (iii) cross-compiler. A keyword cross-compiler generates code for a target different from the host machine where the compiler runs. This contrasts with keyword one-pass compilation and keyword multi-pass compilation, which describe how many passes are used—not where the code runs. 3
To see why quickly:
- Cross-compiler → host machine ≠ target machine. 2
- One-pass / multipass → concerns compilation strategy (single traversal vs multiple passes).
- Optimizing compiler → focuses on applying optimizations (not about host/target separation).
Footnotes
-
Cross compiler - Wikipedia - Defines cross-compiler as generating code for a platform other than where the compiler runs. ↩ ↩2
-
CrossCompiling (Debian Wiki) - Describes cross-compiling as compiling for an architecture other than the compiling machine; discusses host vs target. ↩ ↩2
-
One-pass compiler - Wikipedia - Defines one-pass vs multi-pass compilers and key characteristics. ↩ ↩2
-
Optimizing compiler - Wikipedia - Defines optimizing compilers and what optimization aims to improve. ↩
Cross-compilation & toolchain basics (host vs target)
Vocabulary used in this question
To answer precisely, distinguish these classification dimensions:
- Host vs Target (machine where compiler runs vs machine for generated code): determines cross-compiler.
- Number of passes: determines one-pass vs multi-pass.
- Optimization purpose: determines optimizing compiler.
Key terms:
Footnotes
-
CrossCompiling (Debian Wiki) - Describes cross-compiling as compiling for an architecture other than the compiling machine; discusses host vs target. ↩ ↩2 ↩3 ↩4
-
One-pass compiler - Wikipedia - Defines one-pass vs multi-pass compilers and key characteristics. ↩
-
Optimizing compiler - Wikipedia - Defines optimizing compilers and what optimization aims to improve. ↩
Choose the correct option (reasoning steps)
- 1Step 1
The phrase “runs on one machine and produce code for different machines” indicates a host ≠ target relationship.
- 2Step 2
A compiler that creates executables for a platform other than the one it runs on is called a keyword cross-compiler.
Footnotes
-
Cross compiler - Wikipedia - Defines cross-compiler as generating code for a platform other than where the compiler runs. ↩
-
- 3Step 3
“one-pass” and “multipass” describe compilation strategy (how many passes), not host/target separation. “optimizing compiler” describes optimization, not platform difference.
Footnotes
-
One-pass compiler - Wikipedia - Defines one-pass vs multi-pass compilers and key characteristics. ↩
-
Optimizing compiler - Wikipedia - Defines optimizing compilers and what optimization aims to improve. ↩
-
- 4Step 4
Therefore, the correct answer is (iii) cross-compiler.
Why option (iii) fits best
Mapping each option to what the question describes (host ≠ target).
Quick FAQ: common confusion
Pro Tip
When a question mentions “runs on one machine” vs “code for different machines,” it’s almost always pointing to keyword cross-compilers (host vs target).
Exam trap
“one-pass” and “multipass” sound like they relate to generating different machine code, but they only describe the number of compilation passes. The host/target difference is what defines cross-compiler.
How classification labels relate to compiler behavior
Cross-compiler
Host vs Target framingCompiler runs on a host machine but outputs code meant for a different target platform. 2"
Footnotes
-
Cross compiler - Wikipedia - Defines cross-compiler as generating code for a platform other than where the compiler runs. ↩
-
CrossCompiling (Debian Wiki) - Describes cross-compiling as compiling for an architecture other than the compiling machine; discusses host vs target. ↩
One-pass vs Multi-pass
Pass-count framingCompilers traverse/process source or IR once vs multiple times. "
Footnotes
-
One-pass compiler - Wikipedia - Defines one-pass vs multi-pass compilers and key characteristics. ↩
Optimizing compiler
Transformation framingApplies optimization transformations to improve efficiency. "
Footnotes
-
Optimizing compiler - Wikipedia - Defines optimizing compilers and what optimization aims to improve. ↩
Knowledge Check
A compiler that runs on one machine but produces code for a different machine is called
Explore Related Topics
Operating System Types and the Correct Answer: Multi-user OS
A multi‑user operating system is the sole OS type that enables multiple users to access the same computer concurrently by sharing CPU time and resources while keeping their sessions isolated.
- Uses time‑sharing and process scheduling to create the illusion of simultaneous execution ().
- Provides separate authentication, permissions, and protected memory for each user.
- Contrasts with single‑user, batch, and embedded OSes, which do not support concurrent interactive users.
- Typical examples include Unix/Linux servers and some Windows NT configurations.
Compiler Optimizations: Choosing the Correct Loop-Transformation Answer
Understanding the MCQ: Compiler, Interpreter, Loader/Linker, or None?
The MCQ conflates formal‑machine concepts (a Turing‑like Machine with an unbounded tape) with programming‑language tools, making “None of the mentioned” the only academically correct choice.
- An infinite tape is a modeling assumption; any actual computation uses only a finite portion.
- Compilers translate whole programs, interpreters execute statements incrementally, and loaders/linkers build/run executables—they do not bound the tape.
- An “infinite language” is a set of strings, not a single infinite input to .
- The correct answer is
- In exams, identify domain mismatches and choose the option that rejects the inconsistency.