Question
Given the language , which of the following strings are in ?
- abaabaaabaa
- aaaabaaaa
- baaaaabaaaab
- baaaaabaa
Official answer and solution
- Official answer
- C
- From
- Official GATE 2012 answer key
Solution
Test each candidate string to determine if it can be partitioned into words from the language .
- The language is . Note the properties of the words in :
- Every occurrence of character must be followed by at least one (specifically, either in or followed by from another block). Crucially, no word in ends in , so no string in can end with .
- Test string 1:
abaabaaabaa
- Partition into blocks:
(ab) (aa) (baa) (ab) (aa) - All constituent words .
- Therefore, string 1 is in .
- Test string 2:
aaaabaaaa
- Partition into blocks:
(aa) (aa) (baa) (aa) - All constituent words .
- Therefore, string 2 is in .
- Test string 3:
baaaaabaaaab
- The string ends with the letter
b. Since every word in ends inb's following lettera(either , , or ), any concatenation of words in must terminate with the lettera. - Hence, string 3 cannot be formed from , so .
- Test string 4:
baaaaabaa
- Partition into blocks:
(baa) (aa) (ab) (aa) - All constituent words .
- Therefore, string 4 is in .
- Thus, strings 1, 2, and 4 belong to .
Final answer
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 25 of 65, printed as CS Q.25
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.