wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider the grammer given below:

SxByA

AxxSyAA

ByySyBB

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 grammer?

A
(iii) and (iv)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
(i), (iii) and (iv)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
(i), (ii) and (iii)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
(ii), (v) and (vi)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A (iii) and (iv)
This grammer cannot generate any string starting with xx or ending with xx so (i), (ii) and (v) cannot be generated by the grammer. xyx also cannot be generated by the grammer. The derivation for (iii) xyxy and (iv) yxxy is shown below

SxBxySxyxBxyxy

SyAyxSyxxSyxxy

So only (iii) and (iv) can we derived from this grammer.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Introduction to Grammars
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon