Consider the following grammar G: S → bS | aA | b A → bA | aB B → bB | aS | a…

GATE · 2004 · CS

Consider the following grammar G:

S → bS | aA | b

A → bA | aB

B → bB | aS | a

Let Na(w) and Nb(w) denote the number of a's and b's in a string w respectively. The language L(G) ⊆ {a, b}+ generated by G is

  1. A.

    { w | Na(w) > 3Nb(w)}

  2. B.

    { w | N_b(w) > 3N_a(w) }

  3. C.

    { w | Na(w) = 3k, k ∈ {0, 1, 2, ...}}

  4. D.

    { w | Nb(w) = 3k, k ∈ {0, 1, 2, ...}}

Attempted by 116 students.

Show answer

Correct answer: C

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…