Time Left - 12:00 mins
GATE CS 2019 - Compiler Design (SDT) Quiz-2
Attempt now to get your rank among 305 students!
Question 1
Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?
Question 2
Consider the following SDT
GA-T{Print “-”}
AEa {Print “*”}
EEb {Print “+”}
E {Print “0”}
TEb {Print “1”}
In the SDT uses L-attribute definition, what is the output printed for evaluation of an input string “ba-bb”?
GA-T{Print “-”}
AEa {Print “*”}
EEb {Print “+”}
E {Print “0”}
TEb {Print “1”}
In the SDT uses L-attribute definition, what is the output printed for evaluation of an input string “ba-bb”?
Question 3
Consider the grammar shown below
S →→ i E t S S’ | a
S’ →→ e S | εε
E →→ b
In the predictive parse table, M, of this grammar, the entries M[S’ , e] and M[S’ , $] respectively are
Question 4
Consider the grammar rule E → E1 - E2 for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If E1 and E2 do not have any-common sub-expression, in order to get the shortest possible code
Question 5
Consider the following translation scheme.
S →ER
R →*E {print (‘*’);}R|ε
E →F + E {print (‘+’);}|F
F →(S)|id {print (id.value);}
Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input '2 * 3 +4', this translation scheme prints
S →ER
R →*E {print (‘*’);}R|ε
E →F + E {print (‘+’);}|F
F →(S)|id {print (id.value);}
Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input '2 * 3 +4', this translation scheme prints
Question 6
Consider the grammar with the following translation rules and E as the start symbol.
E→E1#T {E.value=E1.value*T.value}
T {E.value=T.value}
T→T1&F {T.value=T1.value+F.value}
F {T.value=F.value}
F→num {F.value=num.value}
Compute E.value for the root of the parse tree for the expression: 2#3&5#6&4.
- 305 attempts
- 1 upvote
- 1 comment
Aug 14GATE & PSU CS