GATE Computer ScienceHardGATE CSE
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) parsing table have (terminals: + − * / ( ) id num $)?
- A. 22
- B. 20
- C. 24
- D. 27
Correct answer: A. 22
Counting FIRST/FOLLOW placements per nonterminal: E 4, X 4, T 4, Y 6, F 4; total 22 (no multiple entries: 0).
More Compiler Design questions
- 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…
- Procedure P(x, y) { x = x + 1; y = x + y; } is called as P(a, a) with a = 3. What is a after the call under call-by-reference, and under…