Parsing: GATE CS Previous Year Questions

Parsing · Compiler Design

58 questions · asked in 25 of 27 years (2000–2026)

MCQ 46 · MSQ 5 · NAT 71-mark 39 · 2-mark 19

2000Questions per year2026

Questions 51–55 of 58

Q51GATE 20051 markMCQ−0.33 if wrong
Consider the grammar:

E →\rightarrow E + n | E * n | n

For a sentence n + n * n, the handles in the right-sentential form of the reduction are:

Q52GATE 20051 markMCQ−0.33 if wrong
The grammar A→AA∣(A)∣εA\rightarrow AA|(A)|\varepsilon is not suitable for predictive-parsing because the grammar is:

Q53GATE 20041 markMCQ−0.33 if wrong
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.

Q54GATE 20031 markMCQ−0.33 if wrong
Consider the grammar shown below
S→iEtSS′∣aS\rightarrow iEtSS'|a
S′→eS∣ϵS'\rightarrow eS|\epsilon
E→bE\rightarrow b
In the predictive parse table. M, of this grammar, the entries M[S',e] and M[S',$] respectively are

Q55GATE 20031 markMCQ−0.33 if wrong
Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states. The relationship between n1 and n2 is

Keep practising

Topics in Compiler Design

All CS topics ›