Skip to content
Official PYQ · 2016

GATE CS 2016 Set 1 Q43 — Context-free Grammars and Push-down Automata

Explain with AI

Consider the transition diagram of a PDA given below with input alphabet Σ={a,b}\Sigma=\{a,b\} and stack alphabet Γ={X,Z}\Gamma = \{X,Z\}. ZZ is the initial stack symbol. Let LL denote the language accepted by the PDA

Which one of the following is TRUE? 

Choose one option
View worked solution

Answer: D

To determine which option is correct, let us analyze the language LL accepted by the given Pushdown Automaton (PDA) and its properties:

  1. Language Identification: The PDA pushes XX onto the stack for every input symbol aa. While reading aa's, the machine remains in accepting states, which accepts the language L1={an∣n≥0}L_1 = \{a^n \mid n \geq 0\}. If a bb is encountered, the PDA transitions to a state where it pops XX from the stack for each bb. It accepts at the end of the input if the stack is emptied back to the initial symbol ZZ. This matches the number of bb's with aa's, accepting the language L2={anbn∣n≥0}L_2 = \{a^n b^n \mid n \geq 0\}. Thus, the total language accepted is L=L1∪L2={an∣n≥0}∪{anbn∣n≥0}L = L_1 \cup L_2 = \{a^n \mid n \geq 0\} \cup \{a^n b^n \mid n \geq 0\}.
  2. Determinism: A Deterministic PDA (DPDA) can easily decide this language. While reading aa's, the DPDA stays in an accepting state. If the input ends, it accepts ana^n. If a bb appears, it uniquely transitions to a popping state to match the count. Since there are no overlapping transitions (no choice between reading aa or bb, or making ϵ\epsilon-transitions), the machine is completely deterministic.

Therefore, LL is a deterministic context-free language (DCFL), which makes option D the correct statement.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Context-free Grammars and Push-down Automata questions