GATE Computer ScienceHardGATE CS (PYQ pattern)
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 each a or b read; in q0 it may either make an ε-move to q1 or, reading one symbol, jump to q1 without pushing it; in q1 it pops A on a and B on b; and in q1 it moves to qf on ε when Z is on top. How many strings of length at most 8 over {a, b} does it accept?
- A. 31
- B. 61
- C. 62
- D. 60
Correct answer: B. 61
It accepts exactly the palindromes: even ones through the ε guess and odd ones through the one-symbol skip. Counting 2^⌈k/2⌉ for k = 0..8 gives 1+2+2+4+4+8+8+16+16 = 61.
More Theory of Computation questions
- 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) =…
- A TM with rules δ(q0,a) = (q1,X,R); δ(q0,Y) = (q4,Y,R); δ(q1,a) = (q1,a,R); δ(q1,Y) = (q1,Y,R); δ(q1,b) = (q2,Y,R); δ(q2,b) = (q2,b,R)…
- A TM over {0, 1} (blank B, start q0 on the leftmost cell, accepts at qa, rejects by having no applicable rule) has rules: δ(q0,X) =…