A compiler for a high level language that runs on one machine and produces…

2023

A compiler for a high level language that runs on one machine and produces code for a different machine is called :

  1. A.

    Optimizing

  2. B.

    One pass compiler

  3. C.

    Cross compiler

  4. D.

    Multipass compiler

Attempted by 299 students.

Show answer & explanation

Correct answer: C

Correct answer: Cross compiler

Explanation:

  • A cross compiler runs on a host machine with one architecture and operating system but generates executable code for a different target machine or architecture. This is useful when the target environment cannot run a compiler (for example, compiling code for an embedded ARM device on a desktop x86 machine).

  • Optimizing compiler: Applies transformations (such as loop unrolling, constant folding) to produce faster or smaller code for the same target; not specifically about compiling for a different machine.

  • One-pass compiler: Processes the source code in a single pass (reads input once) to perform translation; this describes the compilation strategy, not whether the output targets a different machine.

  • Multipass compiler: Performs multiple passes over the source or intermediate representations to handle complex analyses and optimizations; again, this concerns compilation stages rather than host/target differences.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor