GateAI
Context-Free Grammars and PDAs

GATE CSE 2024 Set 1 · Q59

NAT2 marksEasy

Time

Let G=(V,Σ,S,P)G = (V, \Sigma, S, P) be a context-free grammar in Chomsky Normal Form with Σ={a,b,c}\Sigma = \{a, b, c\} and VV containing 10 variable symbols including the start symbol SS. The string w=a30b30c30w = a^{30} b^{30} c^{30} is derivable from SS. The number of steps (application of rules) in the derivation S→∗wS \rightarrow^* w is ________

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 179

Context-Free Grammars and PDAs

In Chomsky Normal Form (CNF), all production rules are strictly of the following two forms:

  1. A→BCA \rightarrow BC (where A,B,C∈VA, B, C \in V)

  2. A→aA \rightarrow a (where A∈V,a∈ΣA \in V, a \in \Sigma)

For any context-free grammar in CNF:

  • To derive a terminal string ww of length n=∣w∣n = |w|, exactly n−1n - 1 rule applications of type A→BCA \rightarrow BC are required to produce a sentential form of nn non-terminals.

  • Exactly nn rule applications of type A→aA \rightarrow a are required to replace the nn non-terminals with terminal symbols.

Thus, the total number of derivation steps for any string of length nn is:

Total steps=(n−1)+n=2n−1\text{Total steps} = (n - 1) + n = 2n - 1

Here, the given string is w=a30b30c30w = a^{30}b^{30}c^{30}.

n=∣w∣=30+30+30=90n = |w| = 30 + 30 + 30 = 90
Number of derivation steps=2(90)−1=180−1=179\text{Number of derivation steps} = 2(90) - 1 = 180 - 1 = 179

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Context-Free Grammars and PDAs previous year question is Q59 of the GATE CSE 2024 Set 1 paper. Find more GATE CSE PYQs on Context-Free Grammars and PDAs in Theory of Computation, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Context-Free Grammars and PDAs PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Context-Free Grammars and PDAs in GATE CSE

Context-Free Grammars and PDAs has 26 GATE CSE PYQs across 17 papers from 2011 to 2026. 2 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2024 Set 1.

How GATE tests Context-Free Grammars and PDAs

More from GATE CSE 2024 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2024 Set 1 · Q59 · NAT

Let G = (V, , S, P) be a context-free grammar in Chomsky Normal Form with = {a, b, c} and V containing 10 variable symbols including the start symbol S. The string w = a30 b30 c30 is derivable from S. The number of steps (application of rules) in the derivation S →* w is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.