Context-Free Grammars & Languages


Answer & solution
Answer: C (no official key was published)
1. Interpret a as an opening bracket and b as a closing bracket. aSb encloses a balanced string, SS concatenates two balanced strings, and ε is balanced. Conversely, split any nonempty balanced string at its first matching close to obtain these productions.
2. A deterministic stack machine pushes on a, pops on b, rejects a pop from an empty stack, and accepts exactly with empty stack at end. This establishes C.
3. A is false: ε has both the direct S→ε tree and S→SS→εε. B is false because S→SS supplies closure under concatenation. D is false because intersecting with regular a*b* leaves the nonregular language {an bn:n≥0}.
Solution: The grammar generates balanced strings with a as opening bracket and b as closing bracket, including concatenations and the empty word. A deterministic pushdown automaton pushes on a, pops on b, rejects an unmatched b, and accepts at the end exactly when its stack is empty. Thus C is true. The grammar itself is ambiguous, for example ε can be produced directly or through S→SS with two empty children. Its language is closed under concatenation by S→SS and is not regular, since intersection with a*b* gives {aⁿbⁿ:n≥0}.