Question
Official answer and solution
- Official answer
- B
- From
- Official GATE 2014 answer key
Solution
Determine the language accepted by the DFA by analyzing state transitions and compare against the candidate regular expressions.
The DFA has two states (start state) and (accepting state):
- From : on 0 remains at ; on 1 transitions to .
- From : on 0 transitions to ; on 1 remains at .
Notice that:
- Any transition on 1 leads to or stays in the accepting state .
- Any transition on 0 leads to or stays in the non-accepting state .
Therefore, the DFA accepts precisely all strings over that end with '1'.
Now test each regular expression:
-
(I) :
Begins with (first occurrence of 1), followed by any number of blocks that each end with 1 ( or ). Every string generated ends with 1, and any string ending with 1 can be decomposed into such blocks. Thus I represents the DFA. -
(II) :
The first term generates strings of the form ().
The second term generates strings of the form ().
Consider the string , which ends with 1 and is accepted by the DFA. It cannot be generated by (has an alternating 0 after 1) nor by (starts with 0). Thus II does not represent the DFA. -
(III) :
This is the canonical regular expression for all strings ending with 1. Thus III represents the DFA.
Therefore, I and III only represent the DFA (Option B).
B
Assuming regular expression II can generate all strings ending in 1, missing counterexamples with multiple alternations like 0101.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 1
- Question
- 46 of 65, printed as CS Q.36
- 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.