1
GATE CSE 2016 Set 2
+2
-0.6
A student wrote two context-free grammars G1 and G2 for generating a single $$C$$-like array declaration. The dimension of the array is at least one. For example, $${\mathop{\rm int}} \,\,\,\,\,\,\,a[10]\,\,[3];$$\$

The grammars use D as the start symbol, and use six terminal symbols int ; id [ ] num.

Grammar G1 Grammar G2
D → intL; D → intL;
L → id[E L → idE
E → num E → E[num]
E → num][E E → [num]

Which of the grammars correctly generate the declaration mentioned above?

A
Both G1 and G2
B
Only G1
C
Only G2
D
Neither G1 nor G2
2
GATE CSE 2016 Set 1
Numerical
+2
-0
The attributes of three arithmetic operators in some programming language are given below.

Operator Precedence Associativity Arity
+ High Left Binary
_ Medium Right Binary
* Low Left Binary

The value of the expression $$2 - 5 + 1 - 7 * 3$$ in this language is _______________.

3
GATE CSE 2015 Set 3
+2
-0.6
Consider the following grammar $$G$$

\eqalign{ & \,\,\,\,\,\,\,S \to \,\,\,\,\,\,\,F|H \cr & \,\,\,\,\,\,F \to \,\,\,\,\,\,\,p|c \cr & \,\,\,\,\,\,H \to \,\,\,\,\,\,\,d|c \cr}

where $$S, F$$ and $$H$$ are non-terminal symbols, $$p, d,$$ and $$c$$ are terminal symbols. Which of the following statement(s) is/are correct?

$$\,\,\,\,\,\,\,S1.\,\,\,\,\,\,\,LL\left( 1 \right)\,\,$$ can parse all strings that are generated using grammar $$G$$
$$\,\,\,\,\,\,\,S2.\,\,\,\,\,\,\,LR\left( 1 \right)\,\,$$ can parse all strings that are generated using grammar $$G$$

A
Only $$S1$$
B
Only $$S2$$
C
both $$S1$$ and $$S2$$
D
Neither $$S1$$ nor $$S2$$
4
GATE CSE 2014 Set 1
+2
-0.6

A canonical set of items is given below

\eqalign{ & S \to L. > R \cr & Q \to R. \cr}

On input symbol < the set has

A
a shift-reduce conflict and a reduce-reduce conflict.
B
a shift-reduce conflict but not a reduce-reduce conflict.
C
a reduce-reduce conflict but not a shift-reduce conflict.
D
neither a shift-reduce nor a reduce-reduce conflict.
GATE CSE Subjects
EXAM MAP
Medical
NEET