All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · June 2024 Re-Exam

Consider the grammar:
S → A
A → $B$ | id
B → B, A | A
If I₀ = CLOSURE({[S → ·A]}), then how many items will be in the set GOTO(I₀, $)?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. 5

Explanation

I₀ = {S → ·A, A → ·$B$, A → ·id}. GOTO(I₀, $) starts from A → $·B$; its closure adds B → ·B,A and B → ·A, and then A → ·$B$ and A → ·id. Total 5 items.

More Theory of Computation and Compilers questions