...
Database-Management-System
October 22, 2023
Sequential-Circuits
October 22, 2023
Database-Management-System
October 22, 2023
Sequential-Circuits
October 22, 2023

JNU 2018-1 PhD CS

Question 3
Consider the following context-free grammar:

S → XY, X → aX | bX | a, Y → Ya | Yb | a

A string generated by this grammar has

A
at least one b
B
no consecutive a’s or b’s
C
at least two a’s
D
last symbol as a
E
None of the above
Question 3 Explanation: 
Let’s check option wise,
Option a is false because string “aa” is generated by the given grammar which does not contain b’s.
Option b is false because string “aa” is generated by the given grammar which contains consecutive a’s.
Option d is false because string “aba” contains the last symbol as ‘a’ but not generated by the grammar.
Option c is also false because string “aba” contains two a’s but not generated by the grammar.
Correct Answer: E
Question 3 Explanation: 
Let’s check option wise,
Option a is false because string “aa” is generated by the given grammar which does not contain b’s.
Option b is false because string “aa” is generated by the given grammar which contains consecutive a’s.
Option d is false because string “aba” contains the last symbol as ‘a’ but not generated by the grammar.
Option c is also false because string “aba” contains two a’s but not generated by the grammar.

Leave a Reply

Your email address will not be published. Required fields are marked *