Which of the following languages over the alphabet ∑ = {0, 1} is regular? I. 0n1m II. 0n1m where m = n + 1 III. 0m1n where m ≡ n (mod 3).
Which of the following languages over the alphabet ∑ = {0, 1} is regular? I. 0n1m II. 0n1m where m = n + 1 III. 0m1n where m ≡ n (mod 3). Correct Answer I and III
The correct answer is option 4.
Concept:
A regular language is a language that can be expressed with a regular expression or deterministic or non-deterministic finite automata or state machines. A language is a set of strings that are made up of characters from a specified alphabet, or set of symbols.
Option 1: 0n1m
True, It is a regular language. It accepts language like 0*1*(any number of 0's followed by any number of 1's). The strings like {ε, 0, 1, 00, 11, 01, 000, 001, 011, 111,...}. There is no use of the stack.
Option 2: 0n1m where m = n + 1
False, It is not a regular language because number 0's are depends on the number of 1's. So we can't compare the number of 0's to the number of 1's.
It accepts the strings like {1, 011, 00111, ...}. There is no use of the stack.
Option 3: 0m1n where m ≡ n (mod 3)
True, It is a regular language. The strings where m is the number of digits 0 in the string, n is the number of digits 1 in the string, and m = n modulo 3. Here no one symbol is depending on the other. There is no use of the stack.
Hence the correct answer is I and III.