Question
Language is defined by the grammar:
Language is defined by the grammar:
Consider the following statements:
: is regular
: is regular
Which one of the following is TRUE?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2016 answer key
Solution
Determine the formal language generated by each grammar and test for regularity.
- Analyze Grammar 1 ():
- Derivations:In general: for all .
- Thus, .
- By the Pumping Lemma for regular languages, requires an unbounded stack to match the number of 's and 's. It cannot be accepted by any finite automaton. Hence, is not regular (statement is FALSE).
- Analyze Grammar 2 ():
- Derivations:In general: for all .
- Thus, .
- The regular expression describes , which is accepted by a simple 2-state DFA. Hence, is regular (statement is TRUE).
Therefore, is false and is true, corresponding to option (C).
C
Assuming both grammars generate non-regular languages because both have recursive production rules.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 2
- Question
- 27 of 65, printed as CS Q.17
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.