Skip to content
Official PYQ · 2012

GATE CS 2012 Q46 — Regular Expressions and Finite Automata

Explain with AI

Consider the set of strings on {0,1}\{0,1\} in which, every substring of 33 symbols has at most two zeros. For example, 001110001110 and 011001011001 are in the language, but 100010100010 is not. All strings of length less than 33 are also in the language. A partially completed DFA that accepts this language is shown below.

The missing arcs in the DFA are:

Choose one option
View worked solution

Answer: D

In this DFA, each non-trap state represents the last two symbols read from the input string. The state qq acts as the dead (trap) state, which is reached if three consecutive zeros (000000) are detected.

We can determine the missing transitions by tracking the last two symbols after reading a new input symbol:

  • From state 0000:
    • Reading 00 results in 000000 (invalid), so it must transition to the trap state qq. Thus, 00→0q00 \xrightarrow{0} q.
    • Reading 11 results in the last two symbols being 0101, so it transitions to state 0101. Thus, 00→10100 \xrightarrow{1} 01.
  • From state 0101:
    • Reading 11 results in the last two symbols being 1111, so it transitions to state 1111. Thus, 01→11101 \xrightarrow{1} 11.
  • From state 1010:
    • Reading 00 results in the last two symbols being 0000, so it transitions to state 0000. Thus, 10→00010 \xrightarrow{0} 00.
  • From state 1111:
    • Reading 00 results in the last two symbols being 1010, so it transitions to state 1010. Thus, 11→01011 \xrightarrow{0} 10.

Matching these transitions with the given tables where rows represent the source states, columns represent the destination states, and cell values represent the input symbols, we find that Option D is the correct transition table.

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

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