GATE 2005
203 questions
MCQ 2031-mark 203
Questions 131–135 of 203
where S is the starting symbol, the set of terminals is {a} and the set of non-terminals is {S, W, X, Y, Z}.
We wish to construct a deterministic finite automaton (DFA) to recognize the same language. What is the minimum number of states required for the DFA?
Answer: (B)
and give .
and give .
So becomes .
So . The only terminal is .
Reversing every right-hand side gives a right linear grammar for . Here , because every string is a power of . Its NFA is:
The DFA for (states S, XY, ZW):
The DFA for , with all arrows reversed:
The DFA keeps , so it has 3 states. It cannot have fewer, because , and are pairwise distinguishable. is accepted and the other two are not. Adding one gives (accepted) from , but (rejected) from .
Answer: (B)
Answer: (D)
Example: . In any string of , repeat or delete the first symbol. For the string stays in , and for the string keeps , so it stays in . So both pumping lemmas hold (with pumping length 1). But is not context-free, so is not context-free and not regular.
(A) is false: satisfying both lemmas does not make regular.
(B) is false: it does not even make context-free.
(C) is false: every regular language satisfies both lemmas, so can be regular.
Answer: (D)
Answer: (D)
L(P): q is the start state and also accepting, so the empty string is accepted. A non-empty string cannot be read, because there is no move. So .
N(P): the stack starts with Z and never changes, so it is never empty. So .
This one PDA shows that neither language is necessarily . So A, B and C, which each claim that at least one of them necessarily is , are false. It is tempting to say "q is accepting, so L(P) is everything", but a string is accepted only if the PDA can read all of it, and that needs a move for each symbol.
Answer: (D)
Answer: (A)
Answer: (D)
Let us first choose . Then we get and so .
The complement of a CFL need not be a CFL, because CFLs are not closed under complement.
So, (A) and (B) are false.
Now choose . Then we get and . This is regular, so (C) is also false.
So the answer is (D).