2019 question paper

Compiler Design

26 questions

  1. 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

    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 analysis

    View this question on its own page →
  2. Q1b. 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)

    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.

    View this question on its own page →
  3. 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

    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 optimizer

    View this question on its own page →
  4. Q1d. 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)

    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 conflicts

    View this question on its own page →
  5. Q1e. 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

    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)

    View this question on its own page →
  6. 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)

    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 parser

    View this question on its own page →
  7. Q1g. 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

    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 structure

    View this question on its own page →
  8. Q1h. 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

    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 easier

    View this question on its own page →
  9. Q1i. 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)

    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 above

    View this question on its own page →
  10. Q1j. 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

    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 above

    View this question on its own page →
  11. Q2a. What is an activation record? Explain how they are used to access various local and global variables.20197m

    Module 3 : Semantic Analysis & Symbol Table

    What is an activation record? Explain how they are used to access various local and global variables.

    View this question on its own page →
  12. Q2b. What is bottom-up parsing? Discuss shift reduce parsing technique in brief. What is a handle?20197m

    Module 2 : Syntax Analysis (Parser)

    What is bottom-up parsing? Discuss shift reduce parsing technique in brief. What is a handle?

    View this question on its own page →
  13. 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)

    What is left recursion? Eliminate the left recursion from the following grammar :
    EE+TTE \rightarrow E+T|T
    TTFFT \rightarrow T*F|F
    F(E)idF \rightarrow (E)|id

    View this question on its own page →
  14. 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

    What is the use of a symbol table? How are the identifiers stored in the symbol table?

    View this question on its own page →
  15. Q4a. What is the pass of a compiler? Explain how the single- and multi-pass compilers work.20197m

    Module 1 : Introduction & Lexical Analysis

    What is the pass of a compiler? Explain how the single- and multi-pass compilers work.

    View this question on its own page →
  16. Q4b. Explain architecture and algorithm for the non-recursive predictive parser.20197m

    Module 2 : Syntax Analysis (Parser)

    Explain architecture and algorithm for the non-recursive predictive parser.

    View this question on its own page →
  17. 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)

    Check whether the following grammar is CLR or not :
    SAabBaBabAcS \rightarrow Aa | bBa | Ba | bAc
    AcA \rightarrow c
    BdB \rightarrow d

    View this question on its own page →
  18. Q5b. What is the syntax directed translation and why are they important?20197m

    Module 3 : Semantic Analysis & Symbol Table

    What is the syntax directed translation and why are they important?

    View this question on its own page →
  19. Q6a. Explain different phases of compiler.20197m

    Module 1 : Introduction & Lexical Analysis

    Explain different phases of compiler.

    View this question on its own page →
  20. 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

    Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement:
    a=(ab+c)(b+c)b+ca = (a * b + c) \wedge (b + c) * b + c

    View this question on its own page →
  21. Q7a. Explain various targets for code optimization with examples.20197m

    Module 4 : Intermediate Code Generation & Code Improvement

    Explain various targets for code optimization with examples.

    View this question on its own page →
  22. Q7b. How are CPU registers allocated while creating machine code?20197m

    Module 4 : Intermediate Code Generation & Code Improvement

    How are CPU registers allocated while creating machine code?

    View this question on its own page →
  23. 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)

    Check whether the following grammar is LL(1) grammar or not :
    SiEtSAaS \rightarrow iEtSA | a
    AeSϵA \rightarrow eS | \epsilon
    EbE \rightarrow b

    View this question on its own page →
  24. Q8b. Design the FIRST SET and FOLLOW SET for the grammar.20197m

    Module 2 : Syntax Analysis (Parser)

    Design the FIRST SET and FOLLOW SET for the grammar.

    View this question on its own page →
  25. Q9a. Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.20197m

    Module 3 : Semantic Analysis & Symbol Table

    Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.

    View this question on its own page →
  26. 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

    Explain any two of the following :
    (i) Lexical phase error
    (ii) Code generation using dynamic programming
    (iii) Syntax tree

    View this question on its own page →