2023 question paper

Compiler Design

31 questions

  1. Q1a. Choose the correct answer of the following: Synthesized attributes are calculated (i) from the values of attributes of the children of the node (ii) from the values of attributes of the parent of the node (iii) from the values of attributes of the siblings of the node (iv) None of these20232m

    Module 3 : Semantic Analysis & Symbol Table

    Choose the correct answer of the following:
    Synthesized attributes are calculated
    (i) from the values of attributes of the children of the node
    (ii) from the values of attributes of the parent of the node
    (iii) from the values of attributes of the siblings of the node
    (iv) None of these

    View this question on its own page →
  2. Q1b. Choose the correct answer of the following: Quadruple is a record structure of (i) three fields (ii) four fields (iii) one field (iv) none of these20232m

    Module 4 : Intermediate Code Generation & Code Improvement

    Choose the correct answer of the following:
    Quadruple is a record structure of
    (i) three fields
    (ii) four fields
    (iii) one field
    (iv) none of these

    View this question on its own page →
  3. Q1c. Choose the correct answer of the following: Which of the following statement is true? (i) Every left recursive grammar can be LL(1) (ii) LL(1) grammar can be ambiguous (iii) both (i) and (ii) (iv) None of these20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    Which of the following statement is true?
    (i) Every left recursive grammar can be LL(1)
    (ii) LL(1) grammar can be ambiguous
    (iii) both (i) and (ii)
    (iv) None of these

    View this question on its own page →
  4. Q1d. Choose the correct answer of the following: A bottom-up parser generates (i) right most derivation (ii) right most derivation in reverse (iii) right most derivation (iv) left most derivation in reverse20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    A bottom-up parser generates
    (i) right most derivation
    (ii) right most derivation in reverse
    (iii) right most derivation
    (iv) left most derivation in reverse

    View this question on its own page →
  5. Q1e. Choose the correct answer of the following: Grammar of the programming is checked in ......... phase of compiler. (i) semantic analysis (ii) code generation (iii) syntax analysis (iv) code optimization20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    Grammar of the programming is checked in ......... phase of compiler.
    (i) semantic analysis
    (ii) code generation
    (iii) syntax analysis
    (iv) code optimization

    View this question on its own page →
  6. Q1f. Choose the correct answer of the following: Arrange the following parser according to their power (low to high): SLR, CLR, LALR. (i) LALR, CLR, SLR (ii) LALR, SLR, CLR (iii) CLR, LALR, SLR (iv) CLR, SLR, LALR20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    Arrange the following parser according to their power (low to high): SLR, CLR, LALR.
    (i) LALR, CLR, SLR
    (ii) LALR, SLR, CLR
    (iii) CLR, LALR, SLR
    (iv) CLR, SLR, LALR

    View this question on its own page →
  7. Q1g. Choose the correct answer of the following: A dangling reference is a .............. (i) pointer pointing to storage which is freed (ii) pointer pointing to unutilized storage (iii) pointer pointing to null (iv) none of these20232m

    Module 3 : Semantic Analysis & Symbol Table

    Choose the correct answer of the following:
    A dangling reference is a ..............
    (i) pointer pointing to storage which is freed
    (ii) pointer pointing to unutilized storage
    (iii) pointer pointing to null
    (iv) none of these

    View this question on its own page →
  8. Q1h. Choose the correct answer of the following: Handle pruning forms the basis of ...........? (i) Bottom up parsing (ii) Top down parsing (iii) Predictive parsing (iv) Recursive descent parsing20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    Handle pruning forms the basis of ...........?
    (i) Bottom up parsing
    (ii) Top down parsing
    (iii) Predictive parsing
    (iv) Recursive descent parsing

    View this question on its own page →
  9. Q1i. Choose the correct answer of the following: Left factoring guarantees? (i) Not occurring of backtracking (ii) Cycle free parse tree (iii) Error free target code (iv) Correct LL(1) parsing table20232m

    Module 2 : Syntax Analysis (Parser)

    Choose the correct answer of the following:
    Left factoring guarantees?
    (i) Not occurring of backtracking
    (ii) Cycle free parse tree
    (iii) Error free target code
    (iv) Correct LL(1) parsing table

    View this question on its own page →
  10. Q1j. Choose the correct answer of the following: By which of the following, bodies of two loops merges to form a single loop? (i) Loop Unrolling (ii) Strength Reduction (iii) Loop Concatenation (iv) Loop Fusion20232m

    Module 4 : Intermediate Code Generation & Code Improvement

    Choose the correct answer of the following:
    By which of the following, bodies of two loops merges to form a single loop?
    (i) Loop Unrolling
    (ii) Strength Reduction
    (iii) Loop Concatenation
    (iv) Loop Fusion

    View this question on its own page →
  11. Q2a. What is the difference between a compiler and an interpreter? Discuss the different components of a language processing system using work-flow diagram.20237m

    Module 1 : Introduction & Lexical Analysis

    What is the difference between a compiler and an interpreter? Discuss the different components of a language processing system using work-flow diagram.

    View this question on its own page →
  12. Q2b. Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation. Give annotated parse trees for the inputs 9 - 5 + 2 and 9 - 5 * 2.20237m

    Module 3 : Semantic Analysis & Symbol Table

    Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation. Give annotated parse trees for the inputs 95+29 - 5 + 2 and 9529 - 5 * 2.

    View this question on its own page →
  13. Q3a. Consider the following grammar: S \rightarrow S(S)S/\epsilon (i) Left factor this grammar. (ii) Eliminate left recursion from original grammar. (iii) Is the resulting grammar suitable for top-down parsing?20237m

    Module 2 : Syntax Analysis (Parser)

    Consider the following grammar:
    SS(S)S/ϵS \rightarrow S(S)S/\epsilon
    (i) Left factor this grammar.
    (ii) Eliminate left recursion from original grammar.
    (iii) Is the resulting grammar suitable for top-down parsing?

    View this question on its own page →
  14. Q3b. Construct the DAG for the following basic block: d = b * c e = a + b b = b * c a = e - d20233m

    Module 4 : Intermediate Code Generation & Code Improvement

    Construct the DAG for the following basic block:
    d=bcd = b * c
    e=a+be = a + b
    b=bcb = b * c
    a=eda = e - d

    View this question on its own page →
  15. Q3c. Discuss peephole optimization with suitable example.20234m

    Module 4 : Intermediate Code Generation & Code Improvement

    Discuss peephole optimization with suitable example.

    View this question on its own page →
  16. Q4a. Show that the following grammar is LL(1) but not SLR(1). S \rightarrow AaAb/BbBa A \rightarrow \epsilon B \rightarrow \epsilon20236m

    Module 2 : Syntax Analysis (Parser)

    Show that the following grammar is LL(1) but not SLR(1).
    SAaAb/BbBaS \rightarrow AaAb/BbBa
    AϵA \rightarrow \epsilon
    BϵB \rightarrow \epsilon

    View this question on its own page →
  17. Q4b. What is shift-Reduce conflict?20234m

    Module 2 : Syntax Analysis (Parser)

    What is shift-Reduce conflict?

    View this question on its own page →
  18. Q4c. Translate the following expression into quadruples and triples representation. A = -b * (c + d)/e20234m

    Module 4 : Intermediate Code Generation & Code Improvement

    Translate the following expression into quadruples and triples representation.
    A=b(c+d)/eA = -b * (c + d)/e

    View this question on its own page →
  19. Q5a. Consider the following grammar: S \rightarrow CC C \rightarrow cC/d Construct CLR(1) and LALR(1) parsing table.20239m

    Module 2 : Syntax Analysis (Parser)

    Consider the following grammar:
    SCCS \rightarrow CC
    CcC/dC \rightarrow cC/d
    Construct CLR(1) and LALR(1) parsing table.

    View this question on its own page →
  20. Q5b. When a grammar is called ambiguous? Is there any technique to remove ambiguity? Justify whether the following grammar is ambiguous or not? S \rightarrow aS/Sa/a20235m

    Module 2 : Syntax Analysis (Parser)

    When a grammar is called ambiguous? Is there any technique to remove ambiguity? Justify whether the following grammar is ambiguous or not?
    SaS/Sa/aS \rightarrow aS/Sa/a

    View this question on its own page →
  21. Q6a. Consider the following grammar: E \rightarrow E+T/T T \rightarrow T*F/F F \rightarrow (E)/id Obtain FIRST and FOLLOW sets of the above grammar.20236m

    Module 2 : Syntax Analysis (Parser)

    Consider the following grammar:
    EE+T/TE \rightarrow E+T/T
    TTF/FT \rightarrow T*F/F
    F(E)/idF \rightarrow (E)/id

    Obtain FIRST and FOLLOW sets of the above grammar.

    View this question on its own page →
  22. Q6b. Consider the following grammar: E \rightarrow E+T/T T \rightarrow T*F/F F \rightarrow (E)/id Construct Predictive Parsing Table of the above grammar.20238m

    Module 2 : Syntax Analysis (Parser)

    Consider the following grammar:
    EE+T/TE \rightarrow E+T/T
    TTF/FT \rightarrow T*F/F
    F(E)/idF \rightarrow (E)/id

    Construct Predictive Parsing Table of the above grammar.

    View this question on its own page →
  23. Q7a. Write down the process for identifying basic blocks.20233m

    Module 4 : Intermediate Code Generation & Code Improvement

    Write down the process for identifying basic blocks.

    View this question on its own page →
  24. Q7b. Consider the following code: (i) i = 12 (ii) j = 1 (iii) t1 = 10 * i (iv) t2 = t1 + j (v) t3 = 8 * t2 (vi) t4 = t3 - 88 (vii) a [ t4 ] = 0.0 (viii) j = j + 1 (ix) if j <= 10 goto (iii) (x) i = i + 1 (xi) if i <= 10 goto (ii) (xii) i = 1 (xiii) t5 = i - 1 (xiv) t6 = 88 * t5 (xv) a [ t6 ] = 1.0 (xvi) i = i + 1 (xvii) if i <= 10 goto (xiii) find out the basic block and draw the flow graph for the above code.20238m

    Module 4 : Intermediate Code Generation & Code Improvement

    Consider the following code:
    (i) i = 12
    (ii) j = 1
    (iii) t1 = 10 * i
    (iv) t2 = t1 + j
    (v) t3 = 8 * t2
    (vi) t4 = t3 - 88
    (vii) a [ t4 ] = 0.0
    (viii) j = j + 1
    (ix) if j <= 10 goto (iii)
    (x) i = i + 1
    (xi) if i <= 10 goto (ii)
    (xii) i = 1
    (xiii) t5 = i - 1
    (xiv) t6 = 88 * t5
    (xv) a [ t6 ] = 1.0
    (xvi) i = i + 1
    (xvii) if i <= 10 goto (xiii)

    find out the basic block and draw the flow graph for the above code.

    View this question on its own page →
  25. Q7c. Draw the syntax tree for the following arithmetic expression: a * -(b + c/d)20233m

    Module 2 : Syntax Analysis (Parser)

    Draw the syntax tree for the following arithmetic expression:
    a(b+c/d)a * -(b + c/d)

    View this question on its own page →
  26. Q8a. Differentiate between S-attributed SDT and L-attributed SDT using suitable examples.20235m

    Module 3 : Semantic Analysis & Symbol Table

    Differentiate between S-attributed SDT and L-attributed SDT using suitable examples.

    View this question on its own page →
  27. Q8b. Discuss about operator precedence parser.20235m

    Module 2 : Syntax Analysis (Parser)

    Discuss about operator precedence parser.

    View this question on its own page →
  28. Q8c. Explain three of the targets for code optimization with examples.20234m

    Module 4 : Intermediate Code Generation & Code Improvement

    Explain three of the targets for code optimization with examples.

    View this question on its own page →
  29. Q9a. Write short notes on: Activation Record20237m

    Module 3 : Semantic Analysis & Symbol Table

    Write short notes on: Activation Record

    View this question on its own page →
  30. Q9b. Write short notes on: Lex and Yaac20237m

    Module 1 : Introduction & Lexical Analysis

    Write short notes on: Lex and Yaac

    View this question on its own page →
  31. Q9c. Write short notes on: Handle Pruning20237m

    Module 2 : Syntax Analysis (Parser)

    Write short notes on: Handle Pruning

    View this question on its own page →