GATE Computer ScienceEasyGATE CS (PYQ pattern)
Compute FIRST of every non-terminal of S → A B | B C; A → a A | ε; B → b B | ε; C → c C | 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. 9
- B. 11
- C. 10
- D. 6
Correct answer: A. 9
FIRST(S)={a,b,c,ε}, FIRST(A)={a,ε}, FIRST(B)={b,ε}, FIRST(C)={c}; total 9.
More Compiler Design questions
- With int i = 2 and the array A = [0, 3, 5, 7, 9, 11, 13] (indices from 0), the call f(A[i], i) is made to void f(p, q) { i = i + 1; p = p…
- How many states does the minimal complete DFA (dead state included) for the regular expression (ab | aba) over {a, b} have?
- For E → T R; R → + T R | − T R | ε; T → F P; P → ^ T | ε; F → ( E ) | id, compute FOLLOW of every non-terminal ( counts as a member). What…
- A basic block is converted to a DAG using value numbering, treating + and as commutative, reusing an existing node when the same operator…
- Minimal SSA form is built for 1: if p > 0 goto L2; 2: L1: x = x + 1; 3: if x > n goto L3; 4: L2: y = y + x; 5: if y < m goto L1; 6: L3…
- L is the set of strings over {a, b} that contain abab as a substring but do not end with abab. How many states does the minimal complete…