GATE | GATE CS 2008 | Question 50

Which of the following statements are true?

I. Every left-recursive grammar can be converted to a 
   right-recursive grammar and vice-versa
II. All \epsilon productions can be removed from any context-free 
    grammar by suitable transformations
III. The language generated by a context-free grammar all of whose 
     productions are of the form X --> w or X --> wY (where, w is a string of 
     terminals and Y is a non-terminal), is always regular
IV. The derivation trees of strings generated by a context-free grammar 
    in Chomsky Normal Form are always binary trees 

(A) I, II, III and IV
(B) II, III and IV only
(C) I, III and IV only
(D) I, II and IV only


Answer: (C)

Explanation:  
I is true as we can always remove left recursion from any given grammar.
(For better understanding, see this.)
 
II is false as we can remove all epsilon productions only if grammar doesn’t contain epsilon in the language.
 
III is true as it is the definition of regular grammar.
(For better understanding, see type-3 languages in this article.)
 
IV is true because in chomsky normal form, all the productions are of type X -> YZ or X -> t, where X, Y, Z are variables and ‘t’ is terminal string. When we draw the derivation tree for every node there are at most 2 children. That’s why Derivation trees of grammars in chomsky normal form are Binary trees.
(For better understanding, see this.)
 
Thus, C is the correct choice.

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.