GATE Computer ScienceHardGATE CSE · UGC NET
Grammar: S → A B D; A → a A | ε; B → b B | A c | ε; D → d D | ε. What is |FOLLOW(A)| + |FOLLOW(B)| + |FOLLOW(D)|? (FOLLOW sets may contain $.)
- A. 7
- B. 9
- C. 10
- D. 8
Correct answer: D. 8
FOLLOW(A) = {$, a, b, c, d}, FOLLOW(B) = {$, d}, FOLLOW(D) = {$}; sizes 5+2+1 = 8.
More Compiler Design questions
- Grammar: E → T X; X → + T X | − T X | ε; T → F Y; Y → F Y | / F Y | ε; F → ( E ) | id | num | − F. How many non-empty cells does its LL(1)…
- How many states does the canonical LR(0) automaton have for the augmented grammar S' → S, S → a S b | a b?
- Program: int x = 5; int f() { return x; } int g() { int x = 7; return f() + x; } int h() { int x = 11; return g() + f() + x; } main calls…
- The expression ((((a + b) + c) ((a + b) + d)) - ((a + b) ((a + b) + c))) is stored as a DAG with common subexpressions shared (no…
- Control-flow graph: B1: a=1; b=2; c=a+b; then B2: d=c+b; if d<10 goto B4 (else B3); B3: c=d+a; b=c; goto B2; B4: print(c+a). Edges: B1→B2…
- Let L = { w ∈ {a,b} : the 4th symbol from the right end of w is 'a' }. The minimal DFA for L has how many states (including any dead/trap…