Computer Sciences > Gate 2016 Set-2 > Regular Grammer
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

Correct : R

Given:
Language L1 grammar: S1 → aS1b | ε
Language L2 grammar: S2 → abS2 | ε
Statements:
P: L1 is regular
Q: L2 is regular
To find:
Which statement is TRUE among the given options.
Solution:
First, let me look at the language L1.
Starting from S1, applying S1 → aS1b repeatedly gives strings like ε, ab, aabb, aaabbb, and so on.
So, L1 = {anbn | n ≥ 0}.
A finite automaton cannot keep track of an arbitrary number of a's to match with b's because it has finite memory.
By the pumping lemma, this is a standard non-regular language.
So L1 is not regular, which means statement P is false.
Now let me analyze language L2.
Starting from S2, the production S2 → abS2 generates repeated copies of "ab".
When it terminates with ε, the strings generated are ε, ab, abab, ababab, and so on.
So, L2 = {(ab)n | n ≥ 0}.
I can write the regular expression for this directly as (ab)*.
Since it has a valid regular expression and can easily be recognized by a simple DFA with two states, L2 is regular.
This means statement Q is true.
Hence, P is false and Q is true.
Answer: (C) P is false and Q is true

Similar Questions

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ
Choose the word that is opposite in meaning to the word “coherent”.
#5 MCQ

Related Topics

regular grammar regular language GATE computer science gate 2016 L1 regularity L2 regularity P true Q false L1 grammar definition L2 grammar definition

Unique Visitor Count

Total Unique Visitors

Loading......