AllInfoHub Logo

AllInfoHub – MCQ Practice

Compiler Design – Multiple Choice Questions (MCQs)

  1. 25. What is an LL(1) parser?

    • A. A top-down parser that reads input from Left to right
    • B. performs Leftmost derivation
    • C. and uses 1 lookahead symbol
    • D. A bottom-up parser
  2. 26. What is an LR(0) parser?

    • A. A bottom-up parser that reads input from Left to right
    • B. performs Rightmost derivation in reverse
    • C. and uses 0 lookahead symbols
    • D. A top-down parser
  3. 27. What is an SLR(1) parser?

    • A. A bottom-up parser that uses 1 lookahead symbol to resolve conflicts in LR(0) parsing tables
    • B. A top-down parser with 1 lookahead
    • C. An LR parser with no lookahead
    • D. A parser that uses leftmost derivation
  4. 28. What is an LALR(1) parser?

    • A. A bottom-up parser that merges states with the same lookahead sets in an LR(1) parser
    • B. A top-down parser with limited lookahead
    • C. An LR parser with no lookahead merging
    • D. A parser that simplifies grammar rules
  5. 29. What is an LR(1) parser?

    • A. A powerful bottom-up parser that uses 1 lookahead symbol and does not merge states with the same core
    • B. A simple top-down parser
    • C. An LR parser with 0 lookahead
    • D. A parser designed for ambiguous grammars
  6. 30. What is an abstract syntax tree (AST)?

    • A. A tree representation of the syntactic structure of source code that omits some details of the concrete syntax
    • B. The parse tree itself
    • C. The sequence of tokens
    • D. The symbol table
  7. 31. What is intermediate representation (IR)?

    • A. A language-independent representation of the source program used for analysis and optimization
    • B. The target machine code
    • C. The original source code
    • D. The token stream
  8. 32. Which of the following is a property of a good intermediate representation?

    • A. Ease of generation from source code
    • B. Suitability for optimization
    • C. Ease of translation to target code
    • D. All of the above
  9. 33. What is static single assignment (SSA)?

    • A. An intermediate representation where each variable is assigned a value only once
    • B. A representation where variables can be assigned multiple times
    • C. A representation used only for functional programming languages
    • D. A low-level machine code representation
  10. 34. What is control flow analysis?

    • A. Analyzing the order in which statements in a program are executed
    • B. Analyzing the data flow in a program
    • C. Analyzing the syntax of the program
    • D. Analyzing the lexical structure
  11. 35. What is data flow analysis?

    • A. Analyzing how values are transmitted and used throughout a program
    • B. Analyzing the control flow
    • C. Analyzing the syntax
    • D. Analyzing the lexical structure
  12. 36. What is register allocation?

    • A. The process of assigning variables to registers in the target machine
    • B. The process of allocating memory on the stack
    • C. The process of allocating space for global variables
    • D. The process of assigning data types to variables