Differences between Compiler, Assembler, and Interpreter MCQs

  1. Which of the following is true about a compiler?
    a) Translates code line by line
    b) Translates the entire program into machine code at once
    c) Executes the program directly
    d) Translates and executes code simultaneouslyAnswer: b) Translates the entire program into machine code at once
  2. What is the main function of an assembler?
    a) To translate high-level language code to machine language
    b) To convert assembly language code into machine language
    c) To directly execute the program line by line
    d) To check for syntax errors in high-level codeAnswer: b) To convert assembly language code into machine language
  3. Which of the following is a feature of an interpreter?
    a) It translates the entire program at once
    b) It directly converts high-level code into machine code
    c) It translates code line by line, executing each line immediately
    d) It produces an intermediate code before executionAnswer: c) It translates code line by line, executing each line immediately
  4. Which of the following statements is true about the difference between a compiler and an interpreter?
    a) A compiler translates the code line by line, while an interpreter translates the entire code at once
    b) A compiler converts the entire program to machine code before execution, while an interpreter converts and executes code line by line
    c) An interpreter produces an executable file, while a compiler does not
    d) A compiler executes code immediately, while an interpreter does notAnswer: b) A compiler converts the entire program to machine code before execution, while an interpreter converts and executes code line by line
  5. Which of the following is NOT a characteristic of a compiler?
    a) Faster execution after compilation
    b) It checks and reports errors after analyzing the whole program
    c) It translates high-level code into machine code directly
    d) It executes the program immediately after translationAnswer: d) It executes the program immediately after translation
  6. Which of the following best describes the operation of an assembler?
    a) Converts high-level programming language into machine code
    b) Converts assembly language into machine code
    c) Executes machine code directly
    d) Translates and executes high-level language code line by lineAnswer: b) Converts assembly language into machine code
  7. Which of the following is an advantage of using an interpreter over a compiler?
    a) Faster execution of the program
    b) Generates an executable file
    c) Easier to debug, as it executes code line by line
    d) More efficient in translating complex programsAnswer: c) Easier to debug, as it executes code line by line
  8. Which of the following is true about an interpreter?
    a) It translates the entire code at once
    b) It produces an intermediate code file
    c) It translates and executes code line by line
    d) It cannot detect errors in the codeAnswer: c) It translates and executes code line by line
  9. What is the primary output of an assembler?
    a) An executable program
    b) A machine code file
    c) A bytecode file
    d) An intermediate code fileAnswer: b) A machine code file
  10. Which of the following is true about the execution time of code compiled by a compiler compared to an interpreter?
    a) The code executed by an interpreter is faster than the code compiled by a compiler
    b) The code executed by a compiler is faster than the code executed by an interpreter
    c) Both have the same execution time
    d) It depends on the programming language used

Answer: b) The code executed by a compiler is faster than the code executed by an interpreter

Leave a Comment

All copyrights Reserved by MCQsAnswers.com - Powered By T4Tutorials