GATE / CS ARCHIVE

GATE CSE 2012 / QUESTION 25

Concatenations in a finite language star

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2012 paper

GATE 2012, Q25 1 mark · MCQ
Report issue

Regular Expressions & Languages

Question 25, GATE 2012: Given the language L = {ab, aa, baa}, which of the following strings are in L*?

                    1)   abaabaaabaa
                    2)   aaaabaaaa
                    3)   baaaaabaaaab
                    4)   baaaaabaa
        (A) 1, 2 and 3                                   (B) 2, 3 and 4
        (C) 1, 2 and 4                                   (D) 1, 3 and 4







Q. 26 to Q. 55 carry two marks each.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The blocks ab, aa and baa have distinct forced beginnings: at a, the next character decides ab versus aa; at b, only baa is possible. String 1 factors as ab·aa·baa·ab·aa; string 2 as aa·aa·baa·aa; and string 4 as baa·aa·ab·aa. For string 3, baaaaabaaaab, the forced parse is baa·aa·ab·aa·aa followed by a lone b, which is not a block. Its reachable complete-block prefix lengths are 0, 3, 5, 7, 9, 11, but its full length is 12. Thus exactly strings 1, 2, 4 belong to L*, C.

Check: Because no listed block is a prefix of another listed block, greedy block recognition cannot discard an alternative valid segmentation. This prefix-code property makes the forced parse failure of string 3 decisive rather than just one unsuccessful guess.

Original paper, page 5 · Answer key