GATE 2006
191 questions
MCQ 1911-mark 191
Questions 126–130 of 191
I.
II.
III.
IV.
Which of the constructions could lead to a non-regular language?
Answer: (B)
(For a finite it is regular, but the question asks what can go wrong.)
II. prefix(L) is regular. Take a DFA for and make every state from which an accepting state can be reached an accepting state.
III. suffix(L) is regular. Take an NFA for and add a new start state with -moves to every state reachable from the old start. Then the NFA accepts exactly when some leads to the state where starts an accepting run.
IV. half(L) is regular. Take a DFA with transition function , start state and accepting set . After reading keep the pair . Here and is the set of states from which some string of length reaches . Start with . On reading a symbol , the new is the set of states with for some symbol . Accept when . There are finitely many pairs, so it is a DFA.
Only I can lead to a non-regular language.
Answer: (B)
Answer: (C)
The statement in option C is not true.
- Every language has a regular superset: True. is one such superset.
- Every language has a regular subset: True. is one such subset.
- Every subset of a regular language is regular: False. We have , but is not regular.
- Every subset of a finite language is regular: True. By definition, any subset of a finite set is finite. Any finite set is regular. So every subset of a finite language is regular.
Answer: (C)
A. There are only finitely many digit primes. Take the largest of them as . Then the DFA needs states, including one for and one for . No change of state is needed for any .
B. Here only states are enough to recognise .
When the difference goes above or below , the DFA moves to a dead state. Every other state is accepting. Going to the dead state works because of the words "for every prefix of " in . This is what makes the language regular.
C. is not regular.
By the Myhill-Nerode theorem, these sets are all distinct equivalence classes. From a string in any one set, we can append a string that takes the new string to . The same appended string, added to a string from any other set, would not reach .
For example, for we append , and for we append , and so on. So we have to keep the count of and , and this count is not finite.
D. This is regular. A finite automaton with states can keep the counts of and . There cannot be more than possibilities for this. On each input symbol, the transition goes to one of these states.
Correct Answer:
The grammar generates the language
Answer: (B)
Rule for A:
Result for A:
Given rule for S:
Put in A:
Simplify:
Language of S:
Rewrite the strings:
Final form:
Hence, option B is correct.
Which of the following strings is NOT generated by the grammar?
Answer: (B)
Check each option:
(A) aaaa: . Palindrome, generated.
(C) abba: . Palindrome, generated.
(D) babaaabab: . Palindrome, generated.
(B) baba starts with b but ends with a, so it is not a palindrome and cannot be generated.
Answer: (B)