2019 question paper
Compiler Design
26 questions
Q1a. Choose the correct answer of the following: When is the type checking usually done? (i) During syntax directed translation (ii) During lexical analysis (iii) During code optimization (iv) During syntax analysis20192m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Choose the correct answer of the following:
When is the type checking usually done?
(i) During syntax directed translation
(ii) During lexical analysis
(iii) During code optimization
(iv) During syntax analysisQ1b. Choose the correct answer of the following: Which one of the following statements is true? (i) Canonical LR parser is more powerful than LALR parser. (ii) SLR parser is more powerful than LALR. (iii) LALR parser is more powerful than canonical LR parser. (iv) SLR parser, canonical LR parser and LALR parser all have the same power.20192m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Choose the correct answer of the following:
Which one of the following statements is true?
(i) Canonical LR parser is more powerful than LALR parser.
(ii) SLR parser is more powerful than LALR.
(iii) LALR parser is more powerful than canonical LR parser.
(iv) SLR parser, canonical LR parser and LALR parser all have the same power.Q1c. Choose the correct answer of the following: In a compiler, ________ checks every character of the source text. (i) the lexical analyzer (ii) the syntax analyzer (iii) the code generator (iv) the code optimizer20192m
Module 1 : Introduction & Lexical Analysis
View this question on its own page →Choose the correct answer of the following:
In a compiler, ________ checks every character of the source text.
(i) the lexical analyzer
(ii) the syntax analyzer
(iii) the code generator
(iv) the code optimizerQ1d. Choose the correct answer of the following: For a grammar G, shift reduce (S-R) conflicts are present in LALR(1) parser, if and only if (i) the LR(1) parser for G has S-R conflicts (ii) the LR(0) parser for G has S-R conflicts (iii) the SLR(1) parser for G has S-R conflicts (iv) the SLR(0) parser for G has S-R conflicts20192m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Choose the correct answer of the following:
For a grammar G, shift reduce (S-R) conflicts are present in LALR(1) parser, if and only if
(i) the LR(1) parser for G has S-R conflicts
(ii) the LR(0) parser for G has S-R conflicts
(iii) the SLR(1) parser for G has S-R conflicts
(iv) the SLR(0) parser for G has S-R conflictsQ1e. Choose the correct answer of the following: In an absolute loading scheme, which loader function is accomplished by programmer? (i) Allocation (ii) Linking (iii) Reallocation (iv) Both (i) and (ii)20192m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Choose the correct answer of the following:
In an absolute loading scheme, which loader function is accomplished by programmer?
(i) Allocation
(ii) Linking
(iii) Reallocation
(iv) Both (i) and (ii)Q1f. Choose the correct answer of the following: ________ is a top-down parser. (i) Operator precedence parser (ii) An LALR (k) parser (iii) An LR (k) parser (iv) Recursive descent parser20192m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Choose the correct answer of the following:
________ is a top-down parser.
(i) Operator precedence parser
(ii) An LALR (k) parser
(iii) An LR (k) parser
(iv) Recursive descent parserQ1g. Choose the correct answer of the following: The languages that need heap allocation in the runtime environment are those that (i) use global variables (ii) use dynamic scoping (iii) support recursion (iv) allow dynamic data structure20192m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Choose the correct answer of the following:
The languages that need heap allocation in the runtime environment are those that
(i) use global variables
(ii) use dynamic scoping
(iii) support recursion
(iv) allow dynamic data structureQ1h. Choose the correct answer of the following: In compilers, generation of intermediate code based on an abstract machine model is useful because (i) syntax-directed translations can be written for intermediate code generation (ii) to generate code for real machines directly from high-level language program is not possible (iii) portability of the front end of the compiler is enhanced (iv) implementation of lexical and syntax analyses is easier20192m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Choose the correct answer of the following:
In compilers, generation of intermediate code based on an abstract machine model is useful because
(i) syntax-directed translations can be written for intermediate code generation
(ii) to generate code for real machines directly from high-level language program is not possible
(iii) portability of the front end of the compiler is enhanced
(iv) implementation of lexical and syntax analyses is easierQ1i. Choose the correct answer of the following: To convert an arbitrary CFG to an LL(1) grammar (i) factor the grammar alone (ii) remove left recursion alone (iii) remove left recursion and factor the grammar (iv) None of the above20192m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Choose the correct answer of the following:
To convert an arbitrary CFG to an LL(1) grammar
(i) factor the grammar alone
(ii) remove left recursion alone
(iii) remove left recursion and factor the grammar
(iv) None of the aboveQ1j. Choose the correct answer of the following: The method which merges the bodies of two loops is (i) loop rolling (ii) loop jamming (iii) constant folding (iv) None of the above20192m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Choose the correct answer of the following:
The method which merges the bodies of two loops is
(i) loop rolling
(ii) loop jamming
(iii) constant folding
(iv) None of the aboveQ2a. What is an activation record? Explain how they are used to access various local and global variables.20197m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →What is an activation record? Explain how they are used to access various local and global variables.
Q2b. What is bottom-up parsing? Discuss shift reduce parsing technique in brief. What is a handle?20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →What is bottom-up parsing? Discuss shift reduce parsing technique in brief. What is a handle?
Q3a. What is left recursion? Eliminate the left recursion from the following grammar : E \rightarrow E+T|T T \rightarrow T*F|F F \rightarrow (E)|id20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →What is left recursion? Eliminate the left recursion from the following grammar :
Q3b. What is the use of a symbol table? How are the identifiers stored in the symbol table?20197m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →What is the use of a symbol table? How are the identifiers stored in the symbol table?
Q4a. What is the pass of a compiler? Explain how the single- and multi-pass compilers work.20197m
Module 1 : Introduction & Lexical Analysis
View this question on its own page →What is the pass of a compiler? Explain how the single- and multi-pass compilers work.
Q4b. Explain architecture and algorithm for the non-recursive predictive parser.20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Explain architecture and algorithm for the non-recursive predictive parser.
Q5a. Check whether the following grammar is CLR or not : S \rightarrow Aa | bBa | Ba | bAc A \rightarrow c B \rightarrow d20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Check whether the following grammar is CLR or not :
Q5b. What is the syntax directed translation and why are they important?20197m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →What is the syntax directed translation and why are they important?
Q6a. Explain different phases of compiler.20197m
Module 1 : Introduction & Lexical Analysis
View this question on its own page →Explain different phases of compiler.
Q6b. Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement: a = (a * b + c) \wedge (b + c) * b + c20197m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement:
Q7a. Explain various targets for code optimization with examples.20197m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Explain various targets for code optimization with examples.
Q7b. How are CPU registers allocated while creating machine code?20197m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →How are CPU registers allocated while creating machine code?
Q8a. Check whether the following grammar is LL(1) grammar or not : S \rightarrow iEtSA | a A \rightarrow eS | \epsilon E \rightarrow b20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Check whether the following grammar is LL(1) grammar or not :
Q8b. Design the FIRST SET and FOLLOW SET for the grammar.20197m
Module 2 : Syntax Analysis (Parser)
View this question on its own page →Design the FIRST SET and FOLLOW SET for the grammar.
Q9a. Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.20197m
Module 3 : Semantic Analysis & Symbol Table
View this question on its own page →Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.
Q9b. Explain any two of the following : (i) Lexical phase error (ii) Code generation using dynamic programming (iii) Syntax tree20197m
Module 4 : Intermediate Code Generation & Code Improvement
View this question on its own page →Explain any two of the following :
(i) Lexical phase error
(ii) Code generation using dynamic programming
(iii) Syntax tree