2023 question paper
Compiler Design
31 questions
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
View this question on its own page →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 theseQ1b. 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
View this question on its own page →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 theseQ1c. 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)
View this question on its own page →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 theseQ1d. 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)
View this question on its own page →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 reverseQ1e. 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)
View this question on its own page →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 optimizationQ1f. 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)
View this question on its own page →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, LALRQ1g. 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
View this question on its own page →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 theseQ1h. 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)
View this question on its own page →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 parsingQ1i. 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)
View this question on its own page →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 tableQ1j. 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
View this question on its own page →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 FusionQ2a. 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
View this question on its own page →What is the difference between a compiler and an interpreter? Discuss the different components of a language processing system using work-flow diagram.
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
View this question on its own page →Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation. Give annotated parse trees for the inputs and .
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)
View this question on its own page →Consider the following grammar:
(i) Left factor this grammar.
(ii) Eliminate left recursion from original grammar.
(iii) Is the resulting grammar suitable for top-down parsing?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
View this question on its own page →Construct the DAG for the following basic block:
Q3c. Discuss peephole optimization with suitable example.20234m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Discuss peephole optimization with suitable example.
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)
View this question on its own page →Show that the following grammar is LL(1) but not SLR(1).
Q4b. What is shift-Reduce conflict?20234m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →What is shift-Reduce conflict?
Q4c. Translate the following expression into quadruples and triples representation. A = -b * (c + d)/e20234m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Translate the following expression into quadruples and triples representation.
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)
View this question on its own page →Consider the following grammar:
Construct CLR(1) and LALR(1) parsing table.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)
View this question on its own page →When a grammar is called ambiguous? Is there any technique to remove ambiguity? Justify whether the following grammar is ambiguous or not?
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)
View this question on its own page →Consider the following grammar:
Obtain FIRST and FOLLOW sets of the above grammar.
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)
View this question on its own page →Consider the following grammar:
Construct Predictive Parsing Table of the above grammar.
Q7a. Write down the process for identifying basic blocks.20233m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Write down the process for identifying basic blocks.
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
View this question on its own page →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.
Q7c. Draw the syntax tree for the following arithmetic expression: a * -(b + c/d)20233m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Draw the syntax tree for the following arithmetic expression:
Q8a. Differentiate between S-attributed SDT and L-attributed SDT using suitable examples.20235m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Differentiate between S-attributed SDT and L-attributed SDT using suitable examples.
Q8b. Discuss about operator precedence parser.20235m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Discuss about operator precedence parser.
Q8c. Explain three of the targets for code optimization with examples.20234m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Explain three of the targets for code optimization with examples.
Q9a. Write short notes on: Activation Record20237m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Write short notes on: Activation Record
Q9b. Write short notes on: Lex and Yaac20237m
Module 1 : Introduction & Lexical Analysis
View this question on its own page →Write short notes on: Lex and Yaac
Q9c. Write short notes on: Handle Pruning20237m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Write short notes on: Handle Pruning