GATE 2009
66 questions
MCQ 661-mark 24 · 2-mark 42
Questions 41–45 of 66
The above DFA accepts the set of all strings over {0,1} that
Answer: (C)
Read the given DFA. From the start state, 1 stays and 0 goes to the middle state. From the middle state, 1 goes back to the start and 0 goes to the final state. From the final state, 0 stays and 1 goes back to the start. So the final state is reached only when the last two symbols read are 00. Now compare with the DFA for each option (items 1 to 4 are options A to D).
- Strings that start with or
Regular expression - Strings that end with
Regular expression - Strings that end with
Regular expression
- Strings that have the substring
Regular expression
The DFA in item 3 is the same as the given DFA, so the given DFA accepts the strings that end with 00. The others do not match. The given DFA rejects the string 0 (it stops in the middle state), but items 1 and 2 accept it. It also rejects 0010 (which contains 00 but ends in 10), but item 4 accepts it.
Answer: (C)
If the initial state is A = 0, B=0, what is the minimum length of an input string which will take the machine to the state A=0, B=1 with Output=1?
Answer: (A)
Look at the next state part of the table.
Each time the machine reaches state , the output is [rows , , ]. So state 00 comes with output 1.
When the machine reaches state , the output is [rows , ] and also [row ]. So state 01 comes with output 0 and with output 1.
When the machine reaches state , the output is [rows , ]. So state 10 comes with output 0.
The machine never reaches state [ does not appear in the next state part]. So state 11 has a don't know (N) output.
Now draw the Moore Machine for this FSM [from the table: present state x input symbol -> next state].
Read the path from the figure, starting at 00/1:
input 1: 00 01 (row 5, output 0)
input 0: 01 10 (row 2, output 0)
input 1: 10 01 with output 1 (row 7), which is state 01/1.
So the input 101 works, and its length is 3.
No shorter string works. Output 1 together with state 01 comes only from state 10 on input 1 (row 7). The other ways into 01 (rows 3 and 5) give output 0. From 00, input 0 stays in 00 and input 1 goes to 01, so state 10 cannot be reached in one step. State 11 is never reached. So reaching 10 takes at least 2 inputs, and the full string takes at least 2 + 1 = 3.
Answer: (A)
Answer: (D)
The other statements are true:
- (A) The minimal DFA of a regular language is unique, up to renaming the states.
- (B) An NFA is a PDA that never uses its stack, so it converts to a PDA.
- (C) Every context-free language is decidable (for example by the CYK algorithm). A decider for the complement just runs it and flips the result, so the complement is recursive (even though it need not be context-free).
Answer: (D)
Answer: (B)
Answer: all odd length palindromes
Then L is
Answer: (C)
A string in both must have the form and also fit . After the , allows only s, so the part must be empty, which means .
So .
This is not regular, because it needs the number of a's to equal the number of b's (pumping lemma: pumping the a's of breaks the equality). It is context-free: a PDA pushes for each a, pops for each b, then reads one c. This also follows from the fact that a CFL intersected with a regular language is always a CFL.
Answer: (C)