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

Consider the following statements:
S1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
S2: For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.

Which one of the following options is correct?

A
S1 is false and S2 is false
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
S1 is true and S2 is true
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
S1 is true and S2 is false
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
S1 is false and S2 is true
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B S1 is true and S2 is true
S1: Every SLR(1) is unambiguous but every unambiguous in not SLR(1). So S1 is true.
S2: Using CYK algorithm which takes at most O(n3) time to parse a string, where n is the length of the string. So S2 is true.

Both S1 is true and S2 is true.

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Properties
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon