Stacks & Queues

Answer & solution
Answer: B (no official key was published)
1. A stack matches each closing delimiter with the most recently unmatched opening delimiter. Reject an unmatched/mismatched close and accept only if the stack is empty at the end.
2. Thus B. With only one kind of parenthesis a counter is sufficient, but stack is the appropriate listed general delimiter-matching structure.
3. Teaching check: On an opening parenthesis, push it; on a closing one, require and pop its matching opener. The last-in-first-out rule handles nesting such as (()()). A FIFO queue does not retain the most recently opened delimiter at its removal end.