1
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6

Which of the following grammar rules violate the requirements of an operator grammar? P, Q, R are nonterminals, and r, s, t are terminals.

$$\eqalign{ & 1.\,P \to QR \cr & 2.\,P \to QsR \cr & 3.\,P \to \varepsilon \cr & 4.\,P \to QtRr \cr} $$
A
1 only
B
1 and 3 only
C
2 and 3 only
D
3 and 4 only
2
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6

Consider the grammar with the following translation rules and E as the start symbol.

$$\eqalign{ & E \to {E_1}\# T\,\,\left\{ {E.value = {E_1}.value*T.value} \right\} \cr & \,\,\,\,\,\,\,\,\,\,\,\,\,\,|T\,\,\,\,\,\,\,\,\,\,\,\,\left\{ {E.value = T.value} \right\} \cr & T \to {T_1}\& F\,\,\,\left\{ {T.value = {T_1}.value*F.value} \right\} \cr & \,\,\,\,\,\,\,\,\,\,\,\,\,\,|\,F\,\,\,\,\,\,\,\,\,\,\,\left\{ {T.value = F.value} \right\} \cr & F \to num\,\,\,\,\,\,\,\left\{ {F.value = num.value} \right\} \cr} $$

Compute E.value for the root of the parse tree for the expression:
2 # 3 & 5 # 6 & 4.

A
200
B
180
C
160
D
40
3
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6

Consider the grammar shown below

$$\eqalign{ & S \to iEtSS'\,|\,\,a \cr & S' \to eS\,|\,\,\varepsilon \cr & E \to b \cr} $$

In the predictive parse table, $$M$$, of this grammar, the entries $$M\left[ {S',e} \right]$$ and $$M\left[ {S',\phi } \right]$$ respectively are

A
$$\{ \,S' \to eS\,\} $$ and $$\{ \,S' \to \varepsilon \,\} $$
B
$$\{ \,S' \to eS\,\} $$ and $$\{ \,\,\,\} $$
C
$$\{ \,S' \to \varepsilon \,\} $$ and $$\{ \,S' \to \varepsilon \,\} $$
D
$$\{ \,S' \to eS\,,S' \to \varepsilon \} $$ and $$\{ \,S' \to \varepsilon \,\} $$
4
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6

Consider the translation scheme shown below

$$\eqalign{ & S \to TR \cr & R \to + T\left\{ {pr{\mathop{\rm int}} (' + ');} \right\}\,R\,|\,\varepsilon \cr & T \to num\,\left\{ {pr{\mathop{\rm int}} (num.val);} \right\} \cr} $$

Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string '9 + 5 + 2', this translation scheme will print

A
9 + 5 + 2
B
9 5 + 2 +
C
9 5 2 + +
D
+ + 9 5 2
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12