Question
Official answer and solution
- Official answer
- D
- From
- Official GATE 2022 answer key
Solution
Decompose paths in the finite automaton into loops from the initial state and transitions to accepting states.
The automaton has start state and two accepting states and .
From state :
- Moving to on 'a', looping on 'b' (), and returning to on 'b' corresponds to the sub-expression .
- Moving to on 'b', looping on 'a' (), and returning to on 'a' corresponds to the sub-expression .
Any number of round trips that start and end at can be represented by .
From , the path can terminate in an accepting state:
- Reaching and accepting in via 'a' followed by zero or more 'b's: .
- Reaching and accepting in via 'b' followed by zero or more 'a's: .
Combining the cycles at with the terminal paths to the accepting states gives:
This matches Option (D).
Option (D)
Forgetting that loops at can alternate arbitrarily between the branch and the branch.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2022 Computer Science and Information Technology (CS)
- Question
- 12 of 65
- 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.