🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Regular Grammars and Finite Automata: all 10 questions

Quiz: Regular Grammars and Finite Automata · Question 8 of 10

The grammar S → aA, A → Sb | ε mixes right-linear and left-linear rules. Which language does it generate?

The grammar S → aA, A → Sb | ε mixes right-linear and left-linear rules. Which language does it generate?

  1. A.ab
  2. B.(ab)*
  3. C.aⁿ⁺¹bⁿ for n ≥ 0
  4. D.All strings over {a, b}
Answer & explanation

Correct answer: aⁿ⁺¹bⁿ for n ≥ 0

Each round adds an a on the left side of A and a b on its right, so the counts are matched.

Can you get the rest right without peeking?

Take the timed Quiz: Regular Grammars and Finite Automata quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →