GATE Computer ScienceEasyGATE CS (PYQ pattern)
S → C C; C → c C | d is LR(0). In its LR(0) parsing table the reduce action for a complete item is written in every terminal column including $. How many reduce entries does the ACTION table contain (accept excluded)?
- A. 3
- B. 6
- C. 9
- D. 11
Correct answer: C. 9
There are 3 states with a completed item (none mixes shift and reduce); each contributes 2+1 = 3 terminal columns, so 9.
More Compiler Design questions
- For S → A b | B c; A → a A | ε; B → a B | ε (augmented), in how many LR(0) states is there a conflict, how many ACTION cells of the LR(0)…
- How many distinct LR(0) items does the grammar S → i E t S Z | a; Z → e S | ε; E → b have (do not augment it; an ε-production gives…
- Only the lower triangle (i ≥ j) of a 10 × 10 matrix A[1..10][1..10] of 4-byte elements is stored, packed into consecutive words starting…
- For G: S → A A; A → a A | b | ε, which statements are true? I. FOLLOW(A) = {a, b, }. II. G is LL(1). III. G is ambiguous. IV. G is LR(1).
- A DFA reads a binary number most-significant bit first (leading zeros allowed; the empty string counts as 0). How many states does the…
- The grammar S → S a b | S c | A S | x; A → A d | S y | z is transformed by the standard algorithm that removes (indirect and immediate)…