Types of Compilers (Single-pass, Multi-pass, Just-in-time) MCQs

  1. What is a key characteristic of a single-pass compiler?
    a) It processes the source code multiple times
    b) It processes the source code only once
    c) It translates the code directly into machine code
    d) It performs optimization during compilationAnswer: b) It processes the source code only once
  2. Which of the following is a feature of a multi-pass compiler?
    a) It compiles the program in a single pass
    b) It uses multiple passes to process the source code
    c) It does not perform optimization
    d) It directly produces machine code without intermediate stepsAnswer: b) It uses multiple passes to process the source code
  3. What is the main advantage of a multi-pass compiler over a single-pass compiler?
    a) It is faster in compiling large programs
    b) It requires fewer resources
    c) It can handle complex languages with more features
    d) It can translate high-level language into machine code more quicklyAnswer: c) It can handle complex languages with more features
  4. In which type of compiler is the translation of code done at runtime?
    a) Single-pass compiler
    b) Multi-pass compiler
    c) Just-in-time compiler
    d) Batch compilerAnswer: c) Just-in-time compiler
  5. Which of the following is an advantage of Just-in-time (JIT) compilation?
    a) It compiles the entire program in advance
    b) It compiles code just before execution, making it faster for runtime
    c) It uses multiple passes to optimize the code
    d) It is faster than single-pass compilers but slower than multi-pass compilersAnswer: b) It compiles code just before execution, making it faster for runtime
  6. Which type of compiler performs translation during the execution of the program?
    a) Single-pass compiler
    b) Multi-pass compiler
    c) Just-in-time compiler
    d) InterpreterAnswer: c) Just-in-time compiler
  7. What is the key difference between a single-pass compiler and a multi-pass compiler?
    a) A single-pass compiler takes multiple passes to complete the translation
    b) A multi-pass compiler takes only one pass to complete the translation
    c) A single-pass compiler processes the code once, while a multi-pass compiler processes it several times
    d) A multi-pass compiler translates to machine code, while a single-pass compiler only checks for syntax errorsAnswer: c) A single-pass compiler processes the code once, while a multi-pass compiler processes it several times
  8. Which of the following is a disadvantage of a single-pass compiler?
    a) It takes longer to compile code
    b) It requires multiple passes to process complex languages
    c) It cannot optimize the code as efficiently
    d) It cannot handle runtime errorsAnswer: c) It cannot optimize the code as efficiently
  9. In which compiler type is the program translated into machine code only when it is executed?
    a) Single-pass compiler
    b) Multi-pass compiler
    c) Just-in-time compiler
    d) Pre-processorAnswer: c) Just-in-time compiler
  10. Which of the following best describes a multi-pass compiler’s operation?
    a) It translates the entire code in one go
    b) It performs syntax checking and code translation simultaneously
    c) It breaks the compilation process into several passes, each responsible for a specific task
    d) It compiles and executes code without checking for errors

Answer: c) It breaks the compilation process into several passes, each responsible for a specific task

Leave a Comment

All copyrights Reserved by MCQsAnswers.com - Powered By T4Tutorials