2025 question paper

Compiler Design

26 questions

  1. Q1a. Which phase of compiler converts source code into tokens? (i) Code generation (ii) Lexical analysis (iii) Optimization (iv) Parsing20252m

    Module 1 : Introduction & Lexical Analysis

    Which phase of compiler converts source code into tokens?

    (i) Code generation
    (ii) Lexical analysis
    (iii) Optimization
    (iv) Parsing

    View this question on its own page →
  2. Q1b. Which data structure is mainly used in lexical analysis? (i) Queue (ii) Stack (iii) Tree (iv) Finite automata20252m

    Module 1 : Introduction & Lexical Analysis

    Which data structure is mainly used in lexical analysis?

    (i) Queue
    (ii) Stack
    (iii) Tree
    (iv) Finite automata

    View this question on its own page →
  3. Q1c. Which automaton accepts regular languages? (i) PDA (ii) DFA (iii) Turing machine (iv) LBA20252m

    Module 1 : Introduction & Lexical Analysis

    Which automaton accepts regular languages?

    (i) PDA
    (ii) DFA
    (iii) Turing machine
    (iv) LBA

    View this question on its own page →
  4. Q1d. Which parser uses leftmost derivation? (i) LL parser (ii) Bottom-up parser (iii) LR parser (iv) Operator precedence parser20252m

    Module 2 : Syntax Analysis (Parser)

    Which parser uses leftmost derivation?

    (i) LL parser
    (ii) Bottom-up parser
    (iii) LR parser
    (iv) Operator precedence parser

    View this question on its own page →
  5. Q1e. LR parsing is a (i) Top-down parsing (ii) Bottom-up parsing (iii) Recursive parsing (iv) Predictive parsing20252m

    Module 2 : Syntax Analysis (Parser)

    LR parsing is a

    (i) Top-down parsing
    (ii) Bottom-up parsing
    (iii) Recursive parsing
    (iv) Predictive parsing

    View this question on its own page →
  6. Q1f. Which parsing technique is most powerful? (i) LL(1) (ii) Recursive descent (iii) LR(1) (iv) Operator precedence20252m

    Module 2 : Syntax Analysis (Parser)

    Which parsing technique is most powerful?

    (i) LL(1)
    (ii) Recursive descent
    (iii) LR(1)
    (iv) Operator precedence

    View this question on its own page →
  7. Q1g. Synthesized attributes are evaluated from (i) Parent to child (ii) Child to parent (iii) Left to right (iv) Right to left20252m

    Module 3 : Semantic Analysis & Symbol Table

    Synthesized attributes are evaluated from

    (i) Parent to child
    (ii) Child to parent
    (iii) Left to right
    (iv) Right to left

    View this question on its own page →
  8. Q1h. Which attribute is commonly stored in symbol table? (i) Variable type (ii) Address (iii) Scope (iv) All of these20252m

    Module 3 : Semantic Analysis & Symbol Table

    Which attribute is commonly stored in symbol table?

    (i) Variable type
    (ii) Address
    (iii) Scope
    (iv) All of these

    View this question on its own page →
  9. Q1i. Which optimization removes repeated computations? (i) Dead code elimination (ii) Common sub-expression elimination (iii) Loop optimization (iv) Register allocation20252m

    Module 4 : Intermediate Code Generation & Code Improvement

    Which optimization removes repeated computations?

    (i) Dead code elimination
    (ii) Common sub-expression elimination
    (iii) Loop optimization
    (iv) Register allocation

    View this question on its own page →
  10. Q1j. A three-address code uses (i) One operand (ii) Two operands (iii) Three operands (iv) No operands20252m

    Module 4 : Intermediate Code Generation & Code Improvement

    A three-address code uses

    (i) One operand
    (ii) Two operands
    (iii) Three operands
    (iv) No operands

    View this question on its own page →
  11. Q2a. Define Compiler. Explain all phases of a compiler with neat diagram.20257m

    Module 1 : Introduction & Lexical Analysis

    Define Compiler. Explain all phases of a compiler with neat diagram.

    View this question on its own page →
  12. Q2b. Construct a DFA for the regular expression r = 0^*1^*2^*.20257m

    Module 1 : Introduction & Lexical Analysis

    Construct a DFA for the regular expression r=012r = 0^*1^*2^*.

    View this question on its own page →
  13. Q3a. Prove that the following grammar is ambiguous on string 'aab': S \rightarrow aS \mid aSbS \mid \varepsilon20257m

    Module 2 : Syntax Analysis (Parser)

    Prove that the following grammar is ambiguous on string 'aab':

    SaSaSbSεS \rightarrow aS \mid aSbS \mid \varepsilon

    View this question on its own page →
  14. Q3b. Explain top-down and bottom-up parsing techniques.20257m

    Module 2 : Syntax Analysis (Parser)

    Explain top-down and bottom-up parsing techniques.

    View this question on its own page →
  15. Q4a. Describe the working of LL(1) parser. Draw the LL(1) parsing table for the given grammar: S \rightarrow aA \mid bB A \rightarrow a B \rightarrow b20257m

    Module 2 : Syntax Analysis (Parser)

    Describe the working of LL(1) parser. Draw the LL(1) parsing table for the given grammar:

    SaAbBS \rightarrow aA \mid bB
    AaA \rightarrow a
    BbB \rightarrow b

    View this question on its own page →
  16. Q4b. Explain synthesized and inherited attributes with suitable examples.20257m

    Module 3 : Semantic Analysis & Symbol Table

    Explain synthesized and inherited attributes with suitable examples.

    View this question on its own page →
  17. Q5a. Write down Three Address Code for the following expression: (a \times b) + (c + d) - (a + b + c + d)20257m

    Module 4 : Intermediate Code Generation & Code Improvement

    Write down Three Address Code for the following expression:

    (a×b)+(c+d)(a+b+c+d)(a \times b) + (c + d) - (a + b + c + d)

    View this question on its own page →
  18. Q5b. Explain peephole optimization with examples and its benefits.20257m

    Module 4 : Intermediate Code Generation & Code Improvement

    Explain peephole optimization with examples and its benefits.

    View this question on its own page →
  19. Q6a. Define regular expression. Write the regular expression for the language having a string which should have at least one '0' and at least one '1'.20257m

    Module 1 : Introduction & Lexical Analysis

    Define regular expression. Write the regular expression for the language having a string which should have at least one '0' and at least one '1'.

    View this question on its own page →
  20. Q6b. Define Symbol Table. Discuss symbol table implementation techniques.20257m

    Module 3 : Semantic Analysis & Symbol Table

    Define Symbol Table. Discuss symbol table implementation techniques.

    View this question on its own page →
  21. Q7a. Write down the differences between DFA and NFA.20257m

    Module 1 : Introduction & Lexical Analysis

    Write down the differences between DFA and NFA.

    View this question on its own page →
  22. Q7b. Describe the role of shift-reduce parsing with an example.20257m

    Module 2 : Syntax Analysis (Parser)

    Describe the role of shift-reduce parsing with an example.

    View this question on its own page →
  23. Q8a. Explain local and global optimization techniques.20257m

    Module 4 : Intermediate Code Generation & Code Improvement

    Explain local and global optimization techniques.

    View this question on its own page →
  24. Q8b. Compare imperative and non-imperative programming languages.20257m

    Module 5 : Advanced topics

    Compare imperative and non-imperative programming languages.

    View this question on its own page →
  25. Q9a. Convert the regular expression (a+b)^*ab into NFA.20257m

    Module 1 : Introduction & Lexical Analysis

    Convert the regular expression (a+b)ab(a+b)^*ab into NFA.

    View this question on its own page →
  26. Q9b. Discuss ambiguity in grammar. Show that the given grammar is ambiguous: S \rightarrow ABA A \rightarrow aA \mid \varepsilon B \rightarrow bB \mid \varepsilon20257m

    Module 2 : Syntax Analysis (Parser)

    Discuss ambiguity in grammar. Show that the given grammar is ambiguous:

    SABAS \rightarrow ABA
    AaAεA \rightarrow aA \mid \varepsilon
    BbBεB \rightarrow bB \mid \varepsilon

    View this question on its own page →