GATE / CS ARCHIVE

GATE CSE 2014 SET 1 / QUESTION 15

GATE CSE 2014 Set 1 Q15

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2014 Set 1 paper

GATE 2014 Set 1, Q15 1 mark · MCQ
Report issue

Regular Expressions & Languages

Question 15, GATE 2014: Which language is regular? A: {aⁿbⁿ:n≥0}. B: {aⁿ:n is prime}. C: {w over {a,b}: w contains 3k+1 occurrences of b for some k∈ℕ}. D: {ww:w∈{0,1}*}.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Method and setup. Finite-state memory can retain a count modulo a fixed constant, but cannot in general remember arbitrary equal block lengths, primality of unbounded lengths, or an arbitrary string for exact copying. For C, use states representing residues 0,1,2 of the b-count; a leaves the state unchanged and b advances it cyclically.

2. Work through the result and its assumptions. A DFA can count b symbols modulo 3 while ignoring a, accepting the residue 1 class; if natural k excludes 0, a finite initial-count adjustment still makes it regular. The equal-count language is nonregular by pumping; unary prime lengths are not ultimately periodic. The copy language is nonregular: intersection with 0*1*0*1* yields 0i1j0i1j, whose equal nonadjacent blocks defeat pumping on 0p1p0p1p. Thus only C.

Original paper, page 10 · Answer key