Question
Let be a context-free grammar in Chomsky Normal Form with and containing 10 variable symbols including the start symbol . The string is derivable from . The number of steps (application of rules) in the derivation is _________
Official answer and solution
- Official answer
- 179
- From
- Official GATE 2024 answer key
Solution
Use the property that deriving any string of length in a Chomsky Normal Form (CNF) grammar requires production steps.
In Chomsky Normal Form (CNF), every production is either of the form (which increases the number of variables in the sentential form by ) or (which replaces variable with terminal). To derive a string of length :
- Exactly steps of type are used to expand into variables.
- Exactly steps of type are used to convert those variables into terminals.
Here has length . Therefore, the total number of derivation steps is:
179
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
- Question
- 59 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.