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 41–45 of 58

Q41GATE 20071 markMCQ−0.33 if wrong
Which one of the following is a top-down parser?

Q42GATE 20061 markMCQ−0.33 if wrong
The grammar

S→\rightarrowAC|CB
C→\rightarrowaCb|ε\varepsilon
A→\rightarrowaA|a
B→\rightarrowBb|b

generates the language L={aibj∣i≠j}L=\{a^{i}b^{j}|i\neq j\} , what is the length of the derivation (number of steps starting from S) to generate the string albma^{l}b^{m} with l≠ml \neq m?

Q43GATE 20061 markMCQ−0.33 if wrong
Which one of the following grammars generates the language
L={aibj∣i≠j}L=\{a^{i}b^{j}|i\neq j\}
(A)                                   (B)  S → aS | Sb | a | b
    S → AC | CB
    C → aCb | a | b
    A → aA | ∈
    B → Bb | ∈
(C)                                   (D)
    S → AC | CB                           S → AC | CB
    C → aCb | ∈                           C → aCb | ∈
    A → aA | ∈                            A → aA | a
    B → Bb | ∈                            B → Bb | b

Q44GATE 20061 markMCQ−0.33 if wrong
Consider the following grammar
S →\rightarrow FR
R →\rightarrow* S | ε\varepsilon
F →\rightarrow id
In the predictive parser table, M, of the grammar the entries M[S, id] and M[R,$] respectively

Q45GATE 20061 markMCQ−0.33 if wrong
Consider the following grammar.
S →\rightarrow S * E
S →\rightarrow E
E →\rightarrow F + E
E →\rightarrow F
F F →\rightarrow id
Consider the following LR(0) items corresponding to the grammar above.
(i) S →\rightarrow S * .E
(ii) E →\rightarrow F. + E
(iii) E →\rightarrow F + .E
Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

Keep practising

Topics in Compiler Design

All CS topics ›