GATE | GATE CS Mock 2018 | Set 2 | Question 26

Which of following statement(s) is/are not correct?
(I) Languages generated by the grammar S→aSa ∣ aa is not regular.
(II) Languages generated by the grammar S→aSb ∣ aa is not regular.
(III) Languages generated by the grammar S→S1|S3, S1→aS1c |S2|λ, S2→aS2b|λ, S3→aS3b|S4| λ, S4→bS4c|λ is {a^nb^mc^k | k = |n – m|, n≥0, m≥0, k≥0}.
(IV) Languages generated by the grammar S→S1S3, S1→aS1c |S2|λ, S2→aS2b|λ, S3→aS3b|S4| λ, S4→bS4c|λ is {a^nb^mc^k | k = |n – m|, n≥0, m≥0, k≥0}.

(A) Only (II), (IV)
(B) Only (I), (III), (IV)
(C) Only (I), (II), (III)
(D) All of the above


Answer: (B)

Explanation: (I) Grammar S→aSa ∣ aa generates langausge (aa)+ which is regular.
(II) Grammar S→aSb ∣ aa generates langausge a^n(aa)b^n which is not regular.
(III) Production rule of S3 doesn’t follow Language L, as it generates at least one word which is not in L: abcb.
(IV) Grammar generates the word acab which is not in L

Therefore, only statements (I), (III), (IV) are not correct.
Option (B) is correct.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.