Skip to content
Official PYQ · 2008

GATE CS 2008 Q52 — Regular Expressions and Finite Automata

Explain with AI

Match the following NFAs with the regular expressions they correspond to:

P
Q
R
S

 

  1. ϵ+0(01∗1+00)∗01∗\epsilon + 0\left(01^*1+00\right)^*01^*

  2. ϵ+0(10∗1+00)∗0\epsilon + 0\left(10^*1+00\right)^*0

  3. ϵ+0(10∗1+10)∗1\epsilon + 0\left(10^*1+10\right)^*1

  4. ϵ+0(10∗1+10)∗10∗\epsilon + 0\left(10^*1+10\right)^*10^*

Choose one option
View worked solution

Answer: C

We can easily match the NFAs to their corresponding regular expressions by analyzing the suffix of each expression (the part after the main loop) and comparing it with the transitions leading to and looping on the final state of each NFA.

Let's examine the suffixes of the four regular expressions:

  • Expression 1: Ends with 01∗01^*. This corresponds to an NFA where the final state is entered via a 00-transition and has a self-loop of 11. This matches P.
  • Expression 2: Ends with 00. This corresponds to an NFA where the final state is entered via a 00-transition and has no self-loop. This matches Q.
  • Expression 3: Ends with 11. This corresponds to an NFA where the final state is entered via a 11-transition and has no self-loop. This matches R.
  • Expression 4: Ends with 10∗10^*. This corresponds to an NFA where the final state is entered via a 11-transition and has a self-loop of 00. This matches S.

Thus, the correct matching is P-1, Q-2, R-3, S-4, which corresponds to Option C.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Regular Expressions and Finite Automata questions