Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | Gate IT 2007 | Question 48

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Consider the grammar given below

S → x B | y A
A → x | x S | y A A
B → y | y S | y B B

Consider the following strings.

(i) xxyyx
(ii) xxyyxy
(iii) xyxy
(iv) yxxy
(v) yxx
(vi) xyx
Which of the above strings are generated by the grammar ?
(A) (i), (ii), and (iii)
(B) (ii), (v), and (vi)
(C) (ii), (iii), and (iv)
(D) (i), (iii), and (iv)


Answer: (C)

Explanation: Only iii and iv are possible.

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads