Which of the following features cannot be captured by context free grammars?
1994
Which of the following features cannot be captured by context free grammars?
Answer: C. Whether a variable has been declared before its use — Context-free grammars define syntax rules like balanced parentheses or if-then-else structures. However, verifying variable declarations requires semantic…
- A.
Syntax of if–then–else statements
- B.
Syntax of recursive procedures
- C.
Whether a variable has been declared before its use
- D.
Variable names of arbitrary length
Attempted by 184 students.
Show answer & explanation
Correct answer: C
Context-free grammars define syntax rules like balanced parentheses or if-then-else structures. However, verifying variable declarations requires semantic analysis and symbol table tracking across scopes. This context-dependent check exceeds the capabilities of a pure context-free grammar.
A video solution is available for this question — log in and enroll to watch it.
Explore the full course: Iocl Engineers Officers Grade A Paper 2