Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Notes  >  Theory of Computation  >  Previous Year Questions: Push-down Automata

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE) PDF Download

Q1Consider the pushdown automaton (PDA) P below, which runs on the input alphabet {a, b}, has stack alphabet {⊥, A}, and has three states {s, p, q}, with s being the start state. A transition from state u to state v, labelled c/ X / γ , where c is an input symbol or, X is a stack symbol, and γ is a string of stack symbols, represents the fact that in state u, the PDA can read c from the input, with X on the top of its stack, pop X from the stack, push in the string y on the stack, and go to state v. In the initial configuration, the stack has only the symbol in it. The PDA accepts by empty stack.
Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
Which one of the following options correctly describes the language accepted by P?  (2023)
(a) {ambn |1 ≤ m and n < m}
(b) {ambn | 0 ≤ n ≤ m}
(c) {ambn | 0 ≤ m and 0 < n}
(d) {am | 0 ≤ m} ∪ {b| 0 ≤ n}
Ans: 
(a)
Sol:

Only state q empties all the symbols from the stack, so the string must reach to state q in order to get accepted.
Several ways to get into state q are - {am | m >1} U {ambn | n < m}
combining them we will get,
L(P) = {amb|1< m and n < m}, so option (A) is the answer.

Q2: In a pushdown automaton P = (Q, Σ, Γ, δ, q0, F), a transition of the form,
Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
where p, q ∈ Q α ∈ σ ∪ {ϵ}, X, Y, ∈ Γ∪ {ϵ}, represents
(q, Y) ∈ δ(p, a, X)
Consider the following pushdown automaton over the input alphabet ∑ = {a, b} and stack alphabet
Γ = {#, 4}.

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
The number of strings of length 100 accepted by the above pushdown automaton is ___________  (2021 SET-1)
(a) 50
(b) 49
(c) 101
(d) 100
Ans: (a)
Sol: 
Correct Answer: 50

A detailed analysis of the given Automaton(skip if you’re comfortable with PDAs):
Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)

  1. PDAs accept strings either by emptying the stack or by reaching the final state after reading the entire input tape. In this example, the transitions from initial state qo 91 is marked by pushing # into the stack and is the only transition that involves # and can't be popped out again. So, there is no chance of acceptance by emptying the stack rather it's only by reaching the final state.
  2. a's can only be accepted in state q₁ and b's only by state q₂ this implies the string must be of the form {ab} for now.
  3. To read b's from the input tape, we've to pop-out A each time which's obtainable from accepting a's. So, the number b's <a's for all the b's to be accepted in this state.
  4. To reach the final state we need at least one A to make the transition to the final state although it's funny about A not being spent.

Note: Reading ϵ from stack doesn’t use up any of the stack contents just like transitions in a conventional FAs.
The given automaton accepts strings of the form {ambn, where m ≥ n + 1}. And, it's given the question that m + n = 100.
So the possible set values in the form of (m, n) are {(100, 0), (99, 1),..., (51, 49)} which in total there are 50.
Try for (m = 50, n = 50) to better understand why it isn't accepted.

Q 3: Consider the transition diagram of a PDA given below with input alphabet ∑ = {a, b} and stack alphabet F= {X, Z). Z is the initial stack symbol. Let L denote the language accepted by the PDA.
Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
Which one of the following is TRUE?  (2016 SET-1)
(a)
 L = {anbn m ≥ 0} is not accepted by any finite automata
(b) L = {an ∣ n ≥ 0} ∪ {anbn ∣ m ≥ 0} is not accepted by any deterministic PDA
(c) L is not accepted by any Turing machine that halts one very input
(d) L = {an ∣ n ≥ 0} ∪ {anbn ∣ m ≥ 0} is deterministic context-free

Ans: 
(d)
Sol:

Strings accepted at Ist final state are an, n ≥ 0 and strings accepted at IInd final state are anbn, n ≥ 0 (actually n ≥ 1 at this state, n = 0 already included at first state).
L = {an | n ≥ 0} ∪ {anbn | n ≥ 0}
Language is deterministic context-free accepted by DPDA (dpda is already given) and so by TM too, and not regular (as we need stack to implement it), and so cannot accepted by FA
Correct Answer: D

Q4: Consider the NPDA (Q = {q0,q1,q2}, Σ = {0, 1}, Г = {0, 1, 1}, δ, q0, q1, F = {q2}), where (as per usual convention) Q is the set of states, ∑ is the input alphabet, Г is the stack alphabet, δ is the state transition function, q0 is the initial state, ⊥ is the initial stack symbol, and F is the set of accepting states.  (2015 SET-1)
The state transition is as follows:

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
Which one of the following sequences must follow the string 101100 so that the overall string is accepted by the automaton?
(a) 10110
(b) 10010
(c) 01010
(d) 01001
Ans:
(b)
Sol:

Here, Z is used to represent the entire stack content except the top
Z is the string in Stack read from top to bottom. 1, Z → 1Z means, on input symbol 1, the stack content changes from Z to 1Z
In qo state, for '1', a '1' is pushed and for a '0' a '0' is pushed. In q1 state, for a '0' a '1' is popped and for a '1' a '0' is popped. So, the given PDA is accepting all strings of of the form x0x'r or x1x'r or xx'r, where x'r is the reverse of the 1's complement of 2. i.e.:
Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)
The given string 101100 has 6 letters and we are given 5 letter strings. So, x0 is done, with x = 10110.
So, x'= (01001)r = 10010.
Answer is option B.

The document Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Theory of Computation.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
18 videos|69 docs|44 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Previous Year Questions: Push-down Automata - Theory of Computation - Computer Science Engineering (CSE)

1. What is a push-down automaton (PDA)?
Ans. A push-down automaton (PDA) is a type of automaton that can manipulate symbols on a stack to perform computations. It can recognize context-free languages and is more powerful than finite automata.
2. What are the main components of a push-down automaton?
Ans. The main components of a push-down automaton include a finite set of states, an input alphabet, a stack alphabet, a transition function, an initial state, a stack symbol, and a set of final states.
3. How does a push-down automaton differ from a finite automaton?
Ans. A push-down automaton can use a stack to store and retrieve symbols during computation, allowing it to recognize context-free languages. In contrast, a finite automaton has a limited memory and can only recognize regular languages.
4. Can a push-down automaton accept an infinite input string?
Ans. No, a push-down automaton cannot accept an infinite input string. It operates on a finite input string and uses its stack to keep track of symbols during computation.
5. What is the significance of push-down automata in computer science?
Ans. Push-down automata are used to model and analyze the behavior of context-free languages, which are essential in the study of formal languages and compilers. They play a crucial role in understanding the computational capabilities of machines and designing efficient algorithms.
18 videos|69 docs|44 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

video lectures

,

Exam

,

ppt

,

Extra Questions

,

Semester Notes

,

pdf

,

Sample Paper

,

practice quizzes

,

Viva Questions

,

Previous Year Questions with Solutions

,

Important questions

,

mock tests for examination

,

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)

,

MCQs

,

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)

,

Free

,

shortcuts and tricks

,

past year papers

,

study material

,

Objective type Questions

,

Previous Year Questions: Push-down Automata | Theory of Computation - Computer Science Engineering (CSE)

,

Summary

;