IAE Academy

GATE 2023 CS Q.14: solution and answer

GATE 2023 · CSQ.14 · 1 mark · MCQ

Consider the Deterministic Finite-state Automaton (DFA) shown below. The DFA runs on the alphabet , and has the set of states , with being the start state and being the only final state.

Which one of the following regular expressions correctly describes the language accepted by ?

GATE 2023 CS question 14: State diagram with states s, p, q, r.Tap to open full size
Figure from the GATE 2023 CS paper. It is part of the question.
Figure description

State diagram with states s, p, q, r. Start state s (arrow entering from the left). p is the only accepting state (double circle). Transitions: s --1--> p; s --0--> r; p --0--> p (self-loop); p --1--> q; q --1--> p; q --0--> r; r --0,1--> r (self-loop, r is a dead state).

  1. (A)

  2. (B)

  3. (C)

  4. (D)

Answer and solution

ANSWER

The language accepted by is , which is option (C).

Official answer: CSource: Official answer key, GATE 2023 CS (IIT Kanpur)

  1. Read the transitions from the figure: , , , , , , . The start state is and the only final state is .

  2. State is a trap (dead) state: once the machine enters it, it never leaves, so no accepted string passes through . From , the symbol leads to , so every accepted string must begin with and move to .

  3. Every accepted string ends in . Looking at the loops through that avoid : reading from returns to . Reading from goes to . From , reading goes to , so the only usable move is , back to . The ways to go from back to are therefore the blocks and .

  4. The language is the first symbol followed by any sequence of blocks or :

  5. Check the options on short strings. (B) begins with , which the DFA sends to and rejects, so (B) is wrong. (A) does not generate : after the leading the remaining is not of the form . The DFA accepts (), so (A) is wrong. (D) also does not generate , so (D) is wrong. (C) generates , , , , , and the DFA accepts each of these. It also rejects , and (they end in ), and (C) cannot generate them either. So (C) is correct.

KEY IDEA

Remove the dead state and look at the loops through the final state . Each return to is either the block (self-loop) or the block (through ). The string must start with .

WATCH OUT FOR

Writing the loop at as attached to , or as . This forces every to sit next to a block and wrongly rejects strings such as . A can be read at on its own, independently of the blocks.

From the GATE 2023 CS paper. Every question of this paper · Download the full paper · All 18 Finite automata questions, with notes

More Finite automata questions