Skip to content
Official PYQ · 2021

GATE CS 2021 Set 2 Q28 — Regular Expressions and Finite Automata

Explain with AI

Suppose we want to design a synchronous circuit that processes a string of 00’s and 11’s. Given a string, it produces another string by replacing the first 11 in any subsequence of consecutive 11’s by a 00. Consider the following example.

Input sequence:00100011000011100Output sequence:00000001000001100\begin{array}{ll} \text{Input sequence:} & 00100011000011100 \\ \text{Output sequence:} & 00000001000001100 \end{array}

A Mealy Machine is a state machine where both the next state and the output are functions of the present state and the current input.

The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 00 and 11. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables s,t,bs, t, b and yy respectively.

Assume the initial state of the Mealy machine is 00.

What are the Boolean expressions corresponding to tt and yy in terms of ss and bb?

Choose one option
View worked solution

Answer: B

To design the Mealy machine, let us define the meaning of the two states represented by s∈{0,1}s \in \{0, 1\}:

  • State s=0s = 0: The previous input bit was 00 (or we are at the start). We are not currently inside a sequence of consecutive 11’s.
  • State s=1s = 1: The previous input bit was 11. We are currently inside a sequence of consecutive 11’s.

Using this state definition, let us construct the truth table for the next state tt and the output yy based on the current state ss and current input bb:

Current State (ss)Input (bb)Next State (tt)Output (yy)
0000
0110 (first 11 replaced by 00)
1000
1111 (subsequent 11 remains 11)

From the truth table, we can derive the Boolean expressions:

  • Next State (tt): tt is 11 whenever b=1b = 1, regardless of ss.
    ∴t=b\therefore t = b
  • Output (yy): yy is 11 only when both s=1s = 1 and b=1b = 1.
    ∴y=sb\therefore y = sb

Thus, the correct expressions are t=bt = b and y=sby = sb.

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

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