Loading

SET 4


  Question 1

Match all items in Group 1 with correct options from those given in Group 2.
GROUP 1GROUP 2
P.Regular expression1. Syntax analysis
Q. Pushdown automata 2. Code generation
R. Dataflow analysis3. Lexical analysis
S. Register allocation4. Code optimization


A : P-4. Q-1, R-2, S-3
B : P-3, Q-1, R-4, S-2
C : P-3, Q-4, R-1, S-2
D : P-2, Q-1, R-4, S-3


  •  
    .

     Correct answer is :B

     Solution :
      Regular expressions are used in syntax analysis. Pushdown automata is related to context free grammar which is related to syntax analysis. Dataflow analysis is done in code optimization. Register allocation is done in code generation.

  •   Question 2

    Which data structure in a compiler is used for managing information about variables and their attributes?

    A : Abstract syntax tree
    B : Symbol table
    C : Semantic stack
    D : Parse table


  •  
    .

     Correct answer is :B

     Solution :
      In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source.

  •   Question 3

    The program below uses six temporary variables a, b, c, d, e, f.
    a = 1
    b = 10
    c = 20
    d = a+b
    e = c+d
    f = c+e
    b = c+e
    e = b+f
    d = 5+e
    return d+f
    Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute this program without spilling?


    A : 2
    B : 3
    C : 4
    D : 6


  •  
    .

     Correct answer is :B


  •   Question 4

    The grammar S -> aSa | bS | c is

    A : LL(1) but not LR(1)
    B : LR(1)but not LR(1)
    C : Both LL(1)and LR(1)
    D : Neither LL(1)nor LR(1)


  •  
    .

     Correct answer is :C


  • MY REPORT
    TOTAL = 4
    ANSWERED =
    CORRECT / TOTAL = /4
    POSITIVE SCORE =
    NEGATIVE SCORE =
    FINAL SCORE =