Consider L = {ab, aa, baa}. Which of the following strings is NOT in L*?
2022
Consider L = {ab, aa, baa}.
Which of the following strings is NOT in L*?
Answer: A. baaaaabaaaaa — ConceptFor a finite set of words L, the Kleene closure L* contains exactly the strings formed by concatenating zero or more complete words from L. To test…
- A.
baaaaabaaaaa
- B.
abaabaaabaa
- C.
aaaabaaaa
- D.
baaaabaa
Attempted by 506 students.
Show answer & explanation
Correct answer: A
Concept
For a finite set of words L, the Kleene closure L* contains exactly the strings formed by concatenating zero or more complete words from L.
To test membership, scan from left to right and continue only with a word of L that matches the next characters; membership holds only when some complete scan consumes every character.
Application
For baaaaabaaaaa, the first character b forces the word baa, so the scan reaches position 3 and leaves aaabaaaaa.
From position 3, the next matching words are forced in sequence: aa reaches position 5, ab reaches position 7, aa reaches position 9, and aa reaches position 11. One final a remains, but L contains no one-character word, so the scan cannot reach position 12.
The string abaabaaabaa has the complete decomposition ab · aa · baa · ab · aa.
The string aaaabaaaa has the complete decomposition aa · aa · baa · aa.
The string baaaabaa has the complete decomposition baa · aa · baa.
Cross-check
The three complete decompositions consume their strings exactly. The scan of baaaaabaaaaa stops at position 11 of 12, which independently confirms the unmatched final character.
Therefore, baaaaabaaaaa is not in L*.
Explore the full course: Mppsc Assistant Professor Computer Science Paper 2