GATE 2021 CS-Set-2
October 22, 2023
Sequential-Circuits
October 22, 2023
GATE 2021 CS-Set-2
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.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!