GATE Computer ScienceEasyGATE CS (PYQ pattern)
Compute FIRST of every non-terminal of S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε, treating ε as a member of FIRST when the non-terminal is nullable. What is the sum of the sizes of the FIRST sets?
- A. 13
- B. 8
- C. 11
- D. 9
Correct answer: C. 11
FIRST(S)={a,b,c,ε}, FIRST(X)={a,ε}, FIRST(Y)={a,b,ε}, FIRST(Z)={c,ε}; total 11.
More Compiler Design questions
- For S → A b B | c; A → a | ε; B → c B | ε (augmented), in how many LR(0) states is there a conflict, and how many reduce entries does the…
- For S → A B | B C; A → a A | ε; B → b B | ε; C → c C | d, which statement is FALSE?
- In S → A B; A → a | ε; B → A b | c, FOLLOW(A) does not contain . Which of these productions, each added to the grammar on its own, put…
- For S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε (augmented), in how many states is there a conflict in the SLR(1) table, and in how…
- In 1: i = 0; 2: c = 2; 3: L1: if i >= n goto L3; 4: d = c 3; 5: if i > k goto L2; 6: c = 2; 7: L2: e = d + 1; 8: f = a b; 9: i = i + 1…
- L1 is the set of strings over {a, b} whose third symbol from the right is a; its minimal DFA has 8 states. L2 = L1 ∩ {strings of even…