5 5 votes Let $G=(\{S, A, B\},\{a, b\}, R, S)$ be a context-free grammar, where the rules $R$ are:$$S \rightarrow a B|b A, \quad A \rightarrow a| a S|b A A, \quad B \rightarrow b| b S \mid a B B .$$Which of the following is true about $L(G)$ ? $L(G)$ consists of all strings over $\{a, b\}$ with an equal number of $a$ 's and $b$ 's. $L(G)$ consists of all non-empty strings over $\{a, b\}$ with an unequal number of $a$ 's and $b$ 's. $L(G)$ consists of all strings over $\{a, b\}$ where the number of $a$ 's is greater than the number of $b$ 's. $L(G)$ is regular. Theory of Computation goclasses theory-of-computation goclasses-cs-dpp goclasses-cs-dpp-day-139 goclasses-toc-practice-questions + – GO Classes 278 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
2 2 votes The grammar cannot generate the null string, but Option A implies that it does.Ideally, Option A should have read: "L(G) consists of all non-empty strings..."Best possible answer is Option A Rohit_jain 1 answered Nov 25, 2025 Rohit_jain 1 comment Share Follow 0 reply Please log in or register to add a comment.