quiz Compiler Design

Compiler Design and Operation

1. What is the main function of a compiler?

  • A) Translate computer code from a low-level language to a high-level language
  • B) Translate computer code from a high-level language to a low-level language
  • C) Execute high-level programming instructions directly
  • D) Convert machine code into an executable program
B) Translate computer code from a high-level language to a low-level language Explanation

2. What is a compiler-compiler?

  • A) A program that translates machine code to high-level language
  • B) A program that produces compilers or parts of them
  • C) A program that optimizes machine-specific code
  • D) A program that interprets high-level language code
B) A program that produces compilers or parts of them Explanation

3. Which phase of the compiler is responsible for transforming source code into an intermediate representation (IR)?

  • A) Front end
  • B) Middle end
  • C) Back end
  • D) Code generation
A) Front end Explanation

4. Which of the following software translates low-level languages to higher-level ones?

  • A) Interpreter
  • B) Source-to-source compiler
  • C) Decompiler
  • D) Compiler-compiler
C) Decompiler Explanation

5. Which optimization technique is involved in the removal of code that never gets executed?

  • A) Constant propagation
  • B) Loop unrolling
  • C) Dead-code elimination
  • D) Inline expansion
C) Dead-code elimination Explanation