GATE Computer ScienceHardGATE CS (PYQ pattern)
A PDA with start state q0, bottom symbol Z, input alphabet {a, b} and accepting state qf (acceptance by final state) has transitions: δ(q0, a, Z) = {(q0, AZ), (q0, AAZ)}; δ(q0, a, A) = {(q0, AA), (q0, AAA)}; δ(q0, b, A) = {(q1, ε)}; δ(q1, b, A) = {(q1, ε)}; δ(q1, ε, Z) = {(qf, Z)}. Stack tops are written first. How many strings of length exactly 12 does it accept?
- A. 4
- B. 3
- C. 2
- D. 6
Correct answer: B. 3
On each a the PDA nondeterministically pushes 1 or 2 A's, then each b pops one A and the final ε-move needs Z on top. So it accepts aⁿbᵐ with n ≥ 1 and n ≤ m ≤ 2n; with n + m = 12 that gives n = 4, 5, 6: 3 strings.
More Theory of Computation questions
- A PDA with start state q0 and bottom symbol Z accepts by EMPTY STACK. Its transitions (stack top written first) are: δ(q0, a, Z) = {(q0…
- A nondeterministic PDA (start q0, bottom symbol Z, final state qf, acceptance by final state) has the rules: in q0 it pushes A or B for…
- A DPDA has start state q0, bottom symbol Z, accepting state set {q0} (acceptance by final state after the whole input is read) and…
- A nondeterministic PDA over {a, b, c} (acceptance by final state at the end of the input) guesses at the start whether to check #a = #b…
- A single-tape TM with blank B starts in q0 on the leftmost cell of the input 10111. Its rules (state, symbol) → (state, write, move) are…
- A TM (blank B, start q0 on the leftmost input cell, halting state qa) has rules δ(q0,0) = (q0,0,R); δ(q0,1) = (q0,1,R); δ(q0,B) =…