All Exams Test series for 1 year @ ₹349 only
Question

Which of the following string is not generated by the grammar : $S \rightarrow SaSbS \mid \epsilon$ ?

The correct answer is
$aaabb$

Grammar String Generation Analysis

The given grammar is $S \rightarrow SaSbS \mid \epsilon$. This grammar generates strings based on recursive rules. A key property of strings generated by this grammar is that they must contain an equal number of 'a's and 'b's.

Let's analyze why:

  • The base case is $S \rightarrow \epsilon$, which generates the empty string (0 'a's, 0 'b's).
  • The recursive step is $S \rightarrow SaSbS$. If we assume that the strings generated by the three $S$ instances within this rule ($S_1, S_2, S_3$ in $S \rightarrow S_1 a S_2 b S_3$) have an equal number of 'a's and 'b's, then the resulting string $S_1 a S_2 b S_3$ adds one 'a' and one 'b'. Thus, the total number of 'a's and 'b's remains equal.

Therefore, any string generated by this grammar must satisfy $n_a(string) = n_b(string)$, where $n_a$ is the count of 'a's and $n_b$ is the count of 'b's.

Checking String Options

We will now check the number of 'a's and 'b's for each option:

  • Option 1: $aabb$ - Contains 2 'a's and 2 'b's. The counts are equal.
  • Option 2: $abab$ - Contains 2 'a's and 2 'b's. The counts are equal.
  • Option 3: $aababb$ - Contains 3 'a's and 3 'b's. The counts are equal.
  • Option 4: $aaabb$ - Contains 3 'a's and 2 'b's. The counts are not equal.

Conclusion on Derivability

Since the string $aaabb$ does not have an equal number of 'a's and 'b's, it cannot be generated by the grammar $S \rightarrow SaSbS \mid \epsilon$. The other options can be derived:

  • $aabb$: $S \Rightarrow SaSbS \Rightarrow \epsilon a (SaSbS) b \epsilon \Rightarrow a(SaSbS)b \Rightarrow a(\epsilon a \epsilon b \epsilon)b \Rightarrow aabb$.
  • $abab$: $S \Rightarrow SaSbS \Rightarrow \epsilon a \epsilon b (SaSbS) \Rightarrow ab(SaSbS) \Rightarrow ab(\epsilon a \epsilon b \epsilon) \Rightarrow abab$.
  • $aababb$: $S \Rightarrow SaSbS \Rightarrow \epsilon a S b S \Rightarrow a S b S \Rightarrow a (SaSbS) b S \Rightarrow a S a S b S b S \Rightarrow a \epsilon a \epsilon b S b \Rightarrow aab S b \Rightarrow aab (SaSbS) b \Rightarrow aab (a \epsilon b \epsilon) b \Rightarrow aababb$.

The string that is not generated by the grammar is $aaabb$.

Was this answer helpful?

Important Questions from Miscellaneous

  1. Which of the following relationships is/are not true?
    (A). Most probable velocity = $\sqrt{\frac{2RT}{M}}$
    (B). PV = $\frac{3}{2}kT$
    (C). Compressibility factor Z = $\frac{pV}{nRT}$
    (D). Average kinetic energy of gas = $\frac{1}{2}kT$
    Choose the correct answer from the options given below
  2. Match List-I with List-II
    List-IList-II
    Electronic ConfigurationFirst Ionisation energy (kJ mol$^{-1}$)
    (A). ns$^2$(I). 2100
    (B). ns$^2$np$^1$(II). 1400
    (C). ns$^2$np$^3$(III). 800
    (D). ns$^2$np$^6$(IV). 900

    Choose the correct answer from the options given below:
  3. The shielding constant of a 2p electron (calculated using Slater's rules) is
  4. Match List-I with List-II
    List-IList-II
    SpectroscopyProperty
    (A). Raman(I). Polarizability
    (B). FTIR(II). Dipole Moment
    (C). UV-Visible(III). Absorbance
    (D). NMR(IV). Spin

    Choose the correct answer from the options given below:
  5. The structure of protein comprises of:
    (A). Primary structure of protein is associated with amino acids
    (B). Secondary structure of protein is associated to peptides
    (C). Tertiary structure of protein is associated with polypeptide chains
    (D). Quaternary structure of protein is associated with polypeptide chains
    Choose the correct answer from the options given below:
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App