ISRO Computer Science (CSE) 2014 - Question 52

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2014

Consider the following grammar:\n$S \to AB$\n$A \to a$\n$A \to BaB$\n$B \to bbA$\nWhich of the following statements is FALSE?

  • A. The length of every string produced by this grammar is even
  • B. No string produced by this grammar has three consecutive a's
  • C. The length of substring produced by B is always odd
  • D. No string produced by this grammar has four consecutive b's

Answer: D. No string produced by this grammar has four consecutive b's

Explanation: Let's check lengths. \n$A \to a$ (1), $B \to bbA \to bba$ (3). $S \to AB$ (1+3=4 even).\n$A \to BaB \to bba a bba$ (7). $S \to (bbaabba)(bba)$ (10 even).\nLengths of A are odd. Lengths of B are odd. S = A+B (odd+odd=even). (a) is True.\n(c) B length odd. True.\n(d) 4 consecutive b's? $B \to bbA$. If $A \to BaB \to bbA a bbA$. $B \to bb(bbA) a bbA$. 4 b's. True?\nWait, $B \to bbA$. If $A \to a$, $B \to bba$. No 4 b's.\nIf $A \to BaB$, $B \to bbBaB$. If $B \to bba$, $B \to bb(bba)a...$ = $bbbbaa...$ 4 b's! So (d) is False.

| | All questions of ISRO Computer Science (CSE) 2014