UGC NET CS 2015 Dec- paper-2
October 29, 2023UGC NET CS 2014 Dec-Paper-2
October 29, 2023NTA UGC NET JUNE-2023 Paper-2
Question 8 |
L={W ε{a,b,c}*:na(ω)+nb(ω)=nc(ω)} then L is
Context free but not linear
| |
Not context free | |
Context free and linear
| |
Linear |
Here’s an example of a context-free grammar that generates this language:
S -> aSc (This rule adds one ‘a’ and one ‘c’ to the string, maintaining the balance.)
S -> bSd (This rule adds one ‘b’ and one ‘d’ to the string, maintaining the balance.)
S -> ε (This rule allows the string to be empty.)
Using this context-free grammar, you can generate strings that satisfy the condition na + nb = nc. For example:
For na = 2 and nb = 2, you can generate aacbcd.
For na = 3 and nb = 3, you can generate aabbcc.
So, the language is context-free but not linear.
Here’s an example of a context-free grammar that generates this language:
S -> aSc (This rule adds one ‘a’ and one ‘c’ to the string, maintaining the balance.)
S -> bSd (This rule adds one ‘b’ and one ‘d’ to the string, maintaining the balance.)
S -> ε (This rule allows the string to be empty.)
Using this context-free grammar, you can generate strings that satisfy the condition na + nb = nc. For example:
For na = 2 and nb = 2, you can generate aacbcd.
For na = 3 and nb = 3, you can generate aabbcc.
So, the language is context-free but not linear.