Consider the following grammar S ⟶ 0S1|1S0|SS|∈ Consider the following…
Consider the following grammar
S ⟶ 0S1|1S0|SS|∈
Consider the following statements:
S1: The grammar is ambiguous.
S2: The grammar generates language in which every string start and end with different symbols.
Select the correct option.
Answer: A. S1 is true and S2 is false — The grammar is ambiguous as two parse trees can represent epsilon. Parse tree 1: S-> ϵ Parse tree 2: S-> SS -> ϵϵ The grammar doesn’t generate language in…
- A.
S1 is true and S2 is false
- B.
Both S1 and S2 are true
- C.
S1 is false and S2 is true
- D.
Both S1 and S2 are false
Attempted by 100 students.
Show answer & explanation
Correct answer: A
The grammar is ambiguous as two parse trees can represent epsilon.
Parse tree 1: S-> ϵ
Parse tree 2: S-> SS -> ϵϵ
The grammar doesn’t generate language in which every string start and end with different symbols. For ex: grammar generates string “0110”.