Open In App

GATE | Gate IT 2007 | Question 46

Like Article
Like
Save
Share
Report

The two grammars given below generate a language over the alphabet {x, y, z}
2007_46
Which one of the following choices describes the properties satisfied by the strings in these languages?
(A) G1 : No y appears before any x
G2 : Every x is followed by at least one y
(B) G1 : No y appears before any x
G2 : No x appears before any y
(C) G1 : No y appears after any x
G2 : Every x is followed by at least one y
(D) G1 : No y appears after any x
G2 : Every y is followed by at least one x


Answer: (A)

Explanation: For the above question we can see that for all options, properties satisfied by the strings could be defined as some relation between x and y alphabets.
For Grammar 1, Strings with a combination of both x and y can be generated with the following form of production(s) of the grammar only.

S–>xS –>xyB or

S–>zS–>zxS–>zxyB

(In case starting production is S–>x| z| yB, it cannot give both x and y in the string)
Hence in any string with x and y both no y can appear before x can be described as a property satisfied by the strings of the language.

Similarly for Grammar 2, Strings with a combination of both x and y can be generated with the following

form of production(s) of the grammar only.

S–>yS –>yxB–>yxy OR S–>yS –>yxB–>yxyB

S–>xB –>xy OR S–>xB –>xyB

Hence in any string with x and y both every x is followed by atleast one y can be described as a property satisfied by the strings of the language.



This solution is contributed by Yashika Arora.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads