Language L1 is defined by the grammar: S1 -> aS1b | ε Language L2 is defined by the grammar: S2 -> abS2 | ε
Consider the following statements:
P: L1 is regular Q: L2 is regular
Which one of the following is TRUE?
(A) Both P and Q are true
(B) P is true and Q is false
(C) P is false and Q is true
(D) Both P and Q are false
Explanation: L1 has the property that no of a’s should be equal to no of b’s in a string, and all a’s should precede all b’s . Hence extra memory will be required to check this property of a string ( Finite Automaton can’t be built for this type of language). Hence this is not regular language. Therefore P is False.
L2 has the property that no of a’s should be equal to no of b’s, but order of a’s and b’s is different here, it is (ab)*, which will require no extra memory to be accepted.( Finite Automaton can be built for this language). Hence L2 is regular language. Therefore Q is True.
Quiz of this Question