Skip to content
Official PYQ · 2006

GATE CS 2006 Q30 — Regular and Context-free Languages

Explain with AI

For s∈(0+1)∗s\in (0+1)^{*} let d(s)d(s) denote the decimal value of s(s (e.g. d(101)=5).d (101) = 5 ). Let
L={s∈(0+1)∗∣d(s) mod 5=2 and d(s) mod 7≠4}L=\left \{ s\in (0+1)^*\mid d(s) \text{ mod } 5=2 \text{ and }d(s) \text{ mod } 7\neq 4 \right \}Which one of the following statements is true?

Choose one option
View worked solution

Answer: D

To determine the class of the language LL, we can analyze it as the intersection of two simpler languages:

Let L1={s∈(0+1)∗∣d(s)(mod5)=2}L_1 = \{ s \in (0+1)^* \mid d(s) \pmod 5 = 2 \}.
We can construct a Deterministic Finite Automaton (DFA) with 55 states (representing remainders 0,1,2,3,40, 1, 2, 3, 4 modulo 55) to recognize L1L_1. The transition from state qq on reading bit b∈{0,1}b \in \{0, 1\} goes to state (2q+b)(mod5)(2q + b) \pmod 5. Thus, L1L_1 is a regular language.

Let L2={s∈(0+1)∗∣d(s)(mod7)≠4}L_2 = \{ s \in (0+1)^* \mid d(s) \pmod 7 \neq 4 \}.
Similarly, the language L3={s∈(0+1)∗∣d(s)(mod7)=4}L_3 = \{ s \in (0+1)^* \mid d(s) \pmod 7 = 4 \} is regular because it can be recognized by a 77-state DFA. Since regular languages are closed under complementation, its complement L2=L3‾L_2 = \overline{L_3} is also a regular language.

Since regular languages are closed under intersection, the language: L=L1∩L2L = L_1 \cap L_2 is also a regular language.

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

Published
Report a correction
Keep exploringMore Regular and Context-free Languages questions