Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2003 | Question 90

  • Last Updated : 28 Jun, 2021

Let G = ({S}, {a, b} R, S) be a context free grammar where the rule set R is
S → a S b | SS | ε
Which of the following statements is true?
(A) G is not ambiguous
(B) There exist x, y, ∈ L (G) such that xy ∉ L(G)
(C) There is a deterministic pushdown automaton that accepts L(G)
(D) We can find a deterministic finite state automaton that accepts L(G)


Answer: (C)

Explanation:

An ambiguous grammar can be converted to unambiguous one.

Here we can get grammar in partial GNF form as
S -> ab | abS | aSb | aSbS

We can convert this into GNF too but no need for PDA reasoning
so, above grammar is not a ambiguous thus a definite PDA possible

Trick for this is but just deriving 3-4 strings from grammar, we 
can easily understand its (anbn)* above 
expression anbn is in CFL thus closure of DCFG is a DCFG
i.e., you can get L = {ε, ab, abab, aabb, aabbab, abaabb, 
ababab,......}
PDA will push "a" until "b" is read, start popping "a" for the "b" read.

If "a" is read again from the tape then push only when stack is empty 
else terminate.

Repeat this until string is read.

Remember fastest way to get answer is by elimination other options.


Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :