GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 10

GATE CSE 2017 Set 1 Q10

Theory of Computation · Context-Free Grammars & Languages · Full GATE CSE 2017 Set 1 paper

GATE 2017 Set 1, Q10 1 mark · MCQ
Report issue

Context-Free Grammars & Languages

Question 10, GATE 2017: Grammar: S→abScT | abcT; T→bT | b. Which language? A {(ab)^n(cb)^n:n≥1}; B {(ab)^n c b^m1 c b^m2 ... c b^mn:n,m1,...,mn≥1}; C {(ab)^n(cb^m)^n:m,n≥1}; D {(ab)^n(cb^n)^m:m,n≥1}.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. T→bT|b generates bm for any m≥1. Different occurrences of T are expanded independently.

2. After k applications of S→abScT and then S→abcT, there are k+1 leading ab pairs and k+1 trailing cT groups. Put n=k+1≥1.

3. Replace each T by its own positive b count. The result is (ab)n cbm1 ... cbmn, B. Options A and C unnecessarily force all b blocks to have equal size.

Original paper, page 6 · Answer key