Consider the following context-free grammar πΊ.
πβππππ΄π΅π΄πππ
π΄βπππ΅π΅π΄π | ππ΅ππππ
π΅βππ΅π | ππ
In the above grammar, π is the start symbol, π and π are terminal symbols, and π΄ and
π΅ are non-terminal symbols.
Let πΏ(πΊ) be the language generated by the grammar πΊ. For a string π βπΏ(πΊ), let
π1(π ) be the number of πβs in π and π2(π ) be the number of πβs in π .
Which of the following statements is/are true?
Step 1: B always produces equal a's and b's.
\(B \to aBb \mid ab\). The base case \(ab\) has one \(a\) and one \(b\). Each application of \(aBb\) wraps an already-balanced string with one more \(a\) and one more \(b\). So by induction every derivation of \(B\) is balanced: if \(n_1(B)\) and \(n_2(B)\) denote its a-count and b-count, \(n_1(B) = n_2(B) = k\) for some \(k \ge 1\).
Step 2: A always has strictly more a's than b's.
\(A \to aaBBAb \mid bBabaa\).
Using \(bBabaa\): direct terminals are \(b,a,b,a,a\) (3 a's, 2 b's) plus one balanced \(B\). So \(n_1(A) - n_2(A) = 3-2 = 1\).
Using \(aaBBAb\): direct terminals are \(a,a,b\) (2 a's, 1 b) plus two balanced B's (they cancel in the difference) plus a nested \(A'\). So \(n_1(A) - n_2(A) = 1 + [n_1(A') - n_2(A')]\).
So if the recursive rule is used \(m \ge 0\) times before the base rule fires, \(n_1(A) - n_2(A) = m+1 \ge 1\). Hence every derivation of A produces strictly more a's than b's.
Step 3: A also satisfies \(n_1(A) \le \frac{4}{3} n_2(A)\).
Tracking \(n_2(A)\) with minimal B's (\(k=1\)) at each level: base case gives \(n_2(A) = 2+1 = 3\), and every recursive level adds \(1 + 1 + 1 = 3\) to \(n_2(A)\) but only \(1\) to the excess computed in Step 2. So \(n_2(A) = 3(m+1) = 3[n_1(A)-n_2(A)]\), which gives \(n_1(A) = \frac{4}{3}n_2(A)\) in this extreme case; using larger B's only dilutes this ratio further toward 1. So for every derivation of A: \[ n_2(A) < n_1(A) \le \frac{4}{3}n_2(A) \]
Step 4: Combine for S.
\(S \to abaABAbba\). Direct terminals \(a,b,a,b,b,a\) give 3 a's and 3 b's (equal contribution), plus two copies of \(A\) and one balanced \(B\). So: \[ n_1(s) - n_2(s) = [n_1(A_1)-n_2(A_1)] + [n_1(A_2)-n_2(A_2)] \ge 1+1 = 2 \] This proves \(n_1(s) \ge n_2(s)\) (in fact strictly greater) for every string in \(L(G)\) -- so statement (B) is true and (A), which claims a string with \(n_1 < n_2\), is false.
Also, using \(n_1(A_i) \le \frac{4}{3}n_2(A_i)\) with \(n_2(A_i) \ge 3\): \[ n_1(s) - 2n_2(s) = -3 + [n_1(A_1)-2n_2(A_1)] + [n_1(A_2)-2n_2(A_2)] + [n_1(B)-2n_2(B)] \] Each A-bracket is \(\le -\frac{2}{3}n_2(A_i) \le -2\), and the B-bracket is \(-k \le -1\). So \(n_1(s) - 2n_2(s) \le -3-2-2-1 = -8 < 0\), i.e. \(n_1(s) < 2n_2(s)\) always. So statement (D) is true and (C), which claims a string with \(n_1 > 2n_2\), is false.
Final Answer:
\[ \boxed{\text{Options B and D are correct}} \]
A schedule of three database transactions \(T_1\), \(T_2\), and \(T_3\) is shown. \(R_i(A)\) and \(W_i(A)\) denote read and write of data item A by transaction \(T_i\), \(i = 1, 2, 3\). The transaction \(T_1\) aborts at the end. Which other transaction(s) will be required to be rolled back?

Which of the following grammars is/are ambiguous?
Let πΏ1 and πΏ2 be two languages over a finite alphabet, such that πΏ1 β©πΏ2 and πΏ2 are
regular languages.
Which of the following statements is/are always true?
Consider the following grammar where π is the start symbol, and π and π are
terminal symbols.
π βππππ β£ ππ β£ Ο΅
Which of the following statements is/are true?
Let Ξ£ = {π, π, π, π} and let πΏ= {πππππππββ£π, π, π, ββ₯0}.
Which of the following constraints ensure(s) that the language πΏ is context-free?