Following context-free grammar S  aB|bA A  b|aS|bAA B  b|bS|aBB generates…

HPSC Teaching and Computer Science 2022Modified — slightly modified from the official paper; see the solution

Following context-free grammar S  aB|bA A  b|aS|bAA B  b|bS|aBB generates strings of terminals that have

  1. A.

    an even total number of terminals

  2. B.

    odd number of a’s and odd number of b’s

  3. C.

    even number of a’s and even number of b’s

  4. D.

    odd number of a’s and even number of a’s

Attempted by 90 students.

Sign up free to check your answer

Sign up free

Explore the full course: Bpsc

Loading lesson…