GATE Computer ScienceEasyGATE CS (PYQ pattern)
How many distinct LR(0) items does the grammar S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε have (do not augment it; an ε-production gives exactly one item)?
- A. 18
- B. 9
- C. 17
- D. 16
Correct answer: D. 16
A production with right side of length m gives m + 1 items (dot positions); summing over the 7 productions gives 16.
More Compiler Design questions
- Which of the following is/are true? I. Every S-attributed definition is L-attributed. II. Every L-attributed definition can be evaluated…
- For S → S ( S ) | ε (augmented), count the reduce entries ( column included, accept excluded) in the SLR(1) and in the LALR(1) ACTION…
- A table-driven LL(1) parser for S → ( S ) S | ε parses "( ) ( )". Each pop of a non-terminal (expanding it) and each match of a terminal…
- An array A[1..4], [0..5], [1..6] of 8-byte elements is stored in row-major order starting at address 500. What is the address of A[3][2][5]?
- For G: S → A b | a A c | B c | a B b; A → a; B → a, which statements are true? I. G is LL(2). II. G is SLR(1). III. G is LALR(1). IV. The…
- For E → id | E [ E ] | ( E ) (augmented), how many states does the LR(0) automaton have, and which is the strongest of LR(0) / SLR(1) /…