Let L ⊆ ∑* where ∑ = {a, b}. Which of the following is true ?
(A) L = { x | x has an equal number of a‘s and b‘s } is regular
(B) L = { anbn | n ≥ 1 } is regular
(C) L = { x | x has more a‘s than b‘s } is regular
(D) L = {ambn | m ? 1, n ? 1 } is regular
Answer: (D)
Explanation: For option (A) :-
L = { x | x has an equal number of a‘s and b‘s } is regular for equal number of a’s and b’s we need s stack for to store the number of a’s and we push all a’s into the stack and pop all b’s for each a’s hence, a cannot be regular language.
For option (B) :-
L = { anbn | n ≥ 1 } is regular is also not regular , it is same as above language. This language also says that equal number of a’s followed by equal number of b’s so it also need a stack to push all a’s and pop all b’s for each a’s.
For option (C) :-
L= { x | x has more a‘s than b‘s } is also not regular it is also CFL we need stack here for a should be greater than b.
For option (D) :-
L = {ambn | m ≥ 1, n ≥ 1 } is regular language because there is no restriction that equal number of a’s and b’s this language only says that a should be followed by b therefore we can draw a DFA for it.
Option (D) is correct.
Quiz of this Question
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing
Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.