B.TECH - Semester 6 complier desgin Question Paper 2020 (jan)
Practice authentic previous year university questions for better exam preparation.
Sample Questions
- What are compiler construction tools?
- Explain how errors are handled during compilation?
- What is top-down parsing?
- What is code optimization? Explain with an example.
- What is recursive descent parser? ( $\mathbf{5} \boldsymbol{\times} \mathbf{4} \boldsymbol{=} \mathbf{2 0}$ Marks) Answer any one question completely from each module.
- (a) For a source language statement ' $a=a^{*} b+c{ }^{*} 12+a{ }^{*} b$;' where $a, b$ and $c$ are float variables, * and - represents multiplication and subtraction on same data types, show the input and output at each of the compiler phases.
- (b) With the help of suitable examples, explain:
- (i) Derivation (ii) Ambiguous grammar
- Explain what are the following with examples: (a) Regular expressions
- Explain what are the following with examples: (b) Interpreters
- Explain what are the following with examples: (c) Context free grammar
- Explain what are the following with examples: (d) BNF notation
- (a) Convert the following NFA to DFA.
- (b) Draw a single DFA that recognises identifiers, bitwise operators and any five keywords of 'C' programming language. OR
- (a) Construct a DFA for the regular expression ( $c / b$ )aa* $b^{*}$.
- (b) Construct a minimum states DFA for the NFA given below.
- (a) Construct LALR parser for the grammar given below. $$ \begin{aligned} & S \rightarrow L=R \\ & S \rightarrow R \\ & L \rightarrow{ }^{*} R \\ & L \rightarrow a \\ & R \rightarrow L \end{aligned} $$
- (b) Give the operator precedence relation table for grammar $$ E \rightarrow E+E / E^{*} E / a $$
- Explain the following (a) $\mathrm{LL}(1)$ parser
- Explain the following (b) SLR parsers OR
- Explain the following (c) LR grammar
- Explain the following (d) Predictive parsing
- (a) Explain quadruples and triples with an example for each. 10
- (b) Construct the syntax tree and write an equivalent intermediate code for the statement. $c=\left(a^{*} b\right)+(c-d)^{*}\left(a^{*} b\right)$.
- With the help of examples of each explain the following: (a) Back patching
- With the help of examples of each explain the following: (b) Induction variable elimination
- With the help of examples of each explain the following: (c) Strength reduction
- With the help of examples of each explain the following: (d) Code motion $$ (4 \times 5=20 \text { Marks }) $$