CC PRELIM SET C



Q1.Multiple Choice Questions                                                                                 
1 Minimum number of temporary variable required to evaluate expression
X:=a*b+c*d-e*f     is ___
a) 1                                    b) 2                              c) 3                  d) 4
2 ________ should have two properties: Easy to produce and Easy to translate
            a) Code optimization              b) Code generator    c) Intermediate code      d) Symbol table
3 A grammar oriented compiling technique, known as
            a) Syntax directed translation                                                             b) Data flow engines 
c) One pass compiler                                                               d) Two pass compiler
4 What is token for the Lexeme “ Core dumped”?
            a) Keywords                 b) Literals                     c) Identifiers                          d) Sentinels
5 What is the reason behind the division of compiling in to lexical analysis and parsing?
            a) Simple design             b) Efficiency               c) Portability                        d) All of the above
6 General error strategies that a parser can employ to recover from a syntactic error
            a) Panic mode   b) phrase level               c) Error production              d) All of the above

7Backpatching technique is used to merge phases of compiler into one pass.
            a) True                                       b) False
8 The size of all fields in activation record can be determined at
a) Runtime                              b) Compile time          c) Both a & b d) None of the above

9 Loop jamming merging the bodies of two loops, if the two loops have
            a) Same number of iterations & uses the different indices
b) Different number of iterations & uses the same indices
 c) Same number of iterations & uses the same indices                                  d) All above
10 Is it possible to make use of algebraic properties like commutativity and associativity of operands to determine the next token
            a) True                                       b) False


11 Which of the following is not true about dynamic type checking?
            a) Type checking is done during the execution            b) It increases the cost of execution  
c) All the type errors are detected                              d) None of the above
12 A basic block is
            a) A block of non consecutive statements     
b) A block of consecutive statements which may be entered only at the beginning and when entered are executed in sequence without half or possibility of branch except at the end
c) A block of statements whose last statement is always a conditional jump            d) None of the above
13 A block kills an expression X or Y iff
            a) It assigns X or Y and does not subsequently re-compute X or Y 
b) It assigns to both X and Y                        
c) Does not assign to either X or Y      d) None of the above
14 Which of the following is not a loop optimization ?
a) Induction variable elimination          b) Loop unrolling                   
c) Loop jamming                                               d) None of the above
15 A flow graph G is reducible iff we can position the edges in to two disjoint groups, forward edges and back edges with the following properties.
i) The forward edges forming an a cyclic graph in which every node can be reached from the initial node of G.
ii) The forward edges consists of edges whose heads dominates taits
a)      Both i & ii are true            b) Only i is true  c) Only ii is true  d) None of the above
16 Parser perform some local correction to replace comma
            a) Panic mode   b) phrase level               c) Error production              d) Global correction
17 To construct the predictive parser from a grammar
            a) Eliminate left recursion                   b) Left factor the grammar 
c) Compute FIRST and FOLLOW    d) All of the above
18 FOLLOW (A) is ‘a’ if
            a) S=> α aA β              b) S=> α Aa β             c) S=> α β aA  d) S=> β α aA
19 A grammar G is said to be operator precedence if it posses
            a) No production on the right side is ϵ                      
b) No production on the right side has two adjacent non terminals
c) Both a & b                          d) None of the above
20  A parser tree showing the value of attribute at each node
            a) Annotated parse tree           b) Syntax tree              c) Semantic tree            d) All

2          Attempt any four:                                                                                       (5x4=20 Marks)
            a) Describe briefly lex as a tool for constructing lexical analyzer.
b) Distinguish with example, lexemes and sentinels.
c) Describe the construction of dependency graph to show the interdependencies among         the inherited and synthesized attributed attributes.
d) Explain SLR parsing algorithm with example.
e) Explain error recovery in YACC.
3          Attempt any one:                                                                                                     10Marks
a) Explain the predictive parsing for LL (1) grammar with the help of suitable example.
b) What are S-attributed definitions for syntax-directed translation? Illustrate the bottom-up evaluation using these.
4          Define bottom up parsing. Explain LR parsing algorithm with suitable example.    
10 Marks
5          Attempt any four:                                                                                       (5x4=20 Marks)
a) Write note on instruction cost in code generation
b) Write note on Data flow analysis.
c) Write note on Implicit deallocation.
d) Write note on Call by name.
e) Write note on 3-address code for assignment statement.

6          Attempt any one:                                                                                                    10 Marks
a) Explain structure preserving transformation and algebraic transformation on basic block.
b) Explain function preserving transformation and common subexpression in code optimization.

7          What is backpathing? Explain backpatching for Boolean expression.                    10 Marks

Comments