Question 4978 – Theory-of-Computation
December 2, 2023Question 6788 – Theory-of-Computation
December 2, 2023Question 5037 – Theory-of-Computation
LL grammar for the language
L = {an bm cn+m | m≥0, n≥0} is
Correct Answer: C
Question 441 Explanation:
L1 is the language when n=0, m=0.
L1={λ}
L2 is the language when only n=0
L2={bc, bbcc, bbbccc,……}
L3 is the language when only m=0
L3={ ac, aacc, aaaccc, ……..}
L4 is the language when n≠0 and m≠0
L4= {abcc, aabbcccc, aaabbbcccccc,……………}
L= {L1 U L2 U L3 U L4}
L= { λ, bc, bbcc, bbbccc,…….., ac, aacc, aaaccc,………., abcc, aabbcccc,aaabbbcccccc,………}
Option A is incorrect because it does not have any stoping point for condition when m=0 i.e it can’t generate strings { ac, aacc, aaaccc, ……..}
Option B is incorrect because it does not have any stopping point for condition when n=0 i.e it can’t generate strings {bc, bbcc, bbbccc,……}
Option C is correct because it can generate all the strings generated by the language L.
Option D is incorrect because state S1 is unreachable in it. And because of this strings {bc, bbcc, bbbccc,……{abcc, aabbcccc, aaabbbcccccc,……………} can’t be generated.
L1={λ}
L2 is the language when only n=0
L2={bc, bbcc, bbbccc,……}
L3 is the language when only m=0
L3={ ac, aacc, aaaccc, ……..}
L4 is the language when n≠0 and m≠0
L4= {abcc, aabbcccc, aaabbbcccccc,……………}
L= {L1 U L2 U L3 U L4}
L= { λ, bc, bbcc, bbbccc,…….., ac, aacc, aaaccc,………., abcc, aabbcccc,aaabbbcccccc,………}
Option A is incorrect because it does not have any stoping point for condition when m=0 i.e it can’t generate strings { ac, aacc, aaaccc, ……..}
Option B is incorrect because it does not have any stopping point for condition when n=0 i.e it can’t generate strings {bc, bbcc, bbbccc,……}
Option C is correct because it can generate all the strings generated by the language L.
Option D is incorrect because state S1 is unreachable in it. And because of this strings {bc, bbcc, bbbccc,……{abcc, aabbcccc, aaabbbcccccc,……………} can’t be generated.
S → aSc | S1 ; S1 → bS1c | λ
S → aSc | S1| λ ; S1 → bS1c
S → aSc | S1| λ ; S1 → bS1c| λ
S → aSc | λ ; S1 → bS1c| λ|