GATE 2012 CS (CS1) – Question 35
L={ab,aa,baa}. Which strings belong to L*? 1: abaabaaabaa; 2: aaaabaaaa; 3: baaaaabaaaab; 4: baaaaabaa.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) 1,2,4
Explanation
Strings 1,2,4 admit tokenizations: ab·aa·baa·ab·aa; aa·aa·baa·aa; baa·aa·ab·aa respectively. String 3 has no valid factorization into ab,aa,baa (checking possible next tokens exhausts the prefixes). Hence 1,2,4, C. Each chosen token must belong to L.