Database-Management-System
October 22, 2023Sequential-Circuits
October 22, 2023JNU 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
at least one b
|
|
no consecutive a’s or b’s
|
|
at least two a’s
|
|
last symbol as a
|
|
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.
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.
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.
Subscribe
Login
0 Comments