GATE 2008
185 questions
MCQ 1851-mark 52 · 2-mark 133
Questions 121–125 of 185
Answer: (D)
Check each statement.
A is true. The subset construction turns any NFA into an equivalent DFA.
B is true. A deterministic Turing machine can simulate a non-deterministic one by trying all its computation paths in breadth-first order. It accepts exactly the same language.
C is true. Every regular language has a right-linear grammar, which is a context-free grammar, so regular languages are a subset of context-free languages.
D is false. The set of all strings is recursively enumerable (and even recursive). Its subset , the halting language, is not recursive. So a subset of an RE set need not be recursive. In general, every language is a subset of , and not every language is recursive.
Answer: (D)
reads the same forward and backward
contains an even number of 0's and an even number of 1's
Answer: (D)
is regular. A DFA only needs to remember the parity of the 0's and the parity of the 1's read so far. That gives 4 states (even-even, even-odd, odd-even, odd-odd). The start state is even-even, and it is the only accepting state.
(palindromes over an alphabet of at least two symbols, say ) is not regular. Pumping lemma: let be the pumping length and take . Then , so with . The string is not a palindrome. A palindrome needs the same number of 0's on both sides of the 1. So the pumped string is not in .
Only is non-regular, so options with or are wrong.
Answer: (D)
II.
III.
IV.
Answer: (A)
II. is not regular. An automaton would have to count the b's and then match twice that many a's, and a finite automaton cannot count without limit. By the pumping lemma, take . Pumping inside the a's gives more than a's against b's, which breaks .
III. is not regular. If it were, its complement intersected with the regular set would be regular. That intersection is , which is not regular. So III is not regular.
IV. is regular. It is .
Only I and IV are regular.
Answer: (A)
For the string "aabbaab" how many steps are required to derive the string and how many parse trees are there?
Answer: (A)
So the derivation takes steps.
Now count the parse trees. Every string from S has the form , where is used times and comes from A. Each use of or adds 2 symbols, so has even length. The string has length 7, so is odd. It starts with "aab", so . So and . For a given , the production of A at each step is forced by the outer pair of letters: a ... b needs and b ... a needs . So there is only one derivation tree.
Answer: (A)
Which of the following strings is generated by the grammar above?
Answer: (D)
First step:
Use S to A:
Use A to aAb:
Use A to bAa:
Use A to bAa again:
Use A to ε:
So, (D) is the answer.