# Stack

 Question 1
Consider the following sequence of operations on an empty stack.

push(54); push(52); pop(); push(55); push(62); s=pop();

Consider the following sequence of operations on an empty queue.

enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q=dequeue();

The value of s+q is ___________.
 A 94 B 83 C 79 D 86
GATE CSE 2021 SET-1   Data Structure
Question 1 Explanation:
 Question 2
A stack is implemented with an array of ${ }^{\prime} A[0 \ldots N-1]^{\prime}$ and a variable $\text { 'pos'. }$ The push and pop operations are defined by the following code.
 push (x)
A[pos] <- x
pos <- pos -1
end push
pop()
pos <- pos+1
return A[pos]
end pop

Which of the following will initialize an empty stack with capacity N for the above implementation?
 A $\text { pos } \leftarrow-1$ B $\text { pos } \leftarrow 0$ C $\text { pos } \leftarrow 1$ D $\text { pos } \leftarrow N-1$
ISRO CSE 2020   Data Structure
Question 2 Explanation:
 Question 3
Convert the pre-fix expression to in-fix $-^{*}+A B C^{*}-D E+F G$
 A $(A-B)^{*} C+\left(D^{*} E\right)-(F+G)$ B $(A+B)^{*} C-(D-E)^{*}(F-G)$ C $(A+B-C)^{*}(D-E)^{*}(F+G)$ D $(((A+B)*C)-((D-E)*(F+G)))$
ISRO CSE 2020   Data Structure
Question 3 Explanation:
Originally all Options are wrong. We have modified one option.
Click here for detail solution by gateoverflow
 Question 4
Choose the equivalent prefix form of the following expression
$(a+(b-c))^{\star}((d-e) /(f+g-h))$
 A ${ }^{\star}+a-b c /-d e-+f g h$ B ${ }^{\star}+a-b c -/d e-+f g h$ C ${ }^{\star}+a-b c /-ed-+f g h$ D ${ }^{*}+\mathrm{ab}-\mathrm{c} /-\mathrm{de}-+\mathrm{fgh}$
ISRO CSE 2017   Data Structure
Question 4 Explanation:
 Question 5
The best data structure to check whether an arithmetic expression has balanced parenthesis is a:
 A Queue B Stack C Tree D List
ISRO CSE 2017   Data Structure
Question 5 Explanation:
 Question 6
The following postfix expression with single digit operands is evaluated using a stack:
$8 \ 2 \ 3 \ \;\hat{}\; / \ 2 \ 3 * + 5 \ 1 * -$
Note that $\hat{}\;$ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are
 A 6,1 B 5,7 C 3,2 D 1,5
ISRO CSE 2016   Data Structure
Question 6 Explanation:
 Question 7
If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values
 A 2,2,1,1,2 B 2,2,1,2,2 C 2,1,2,2,1 D 2,1,2,2,2
ISRO CSE 2015   Data Structure
Question 7 Explanation:
 Question 8
The result evaluating the postfix expression 10 5 + 60 6 / * 8 - is
 A 284 B 213 C 142 D 71
GATE CSE 2015 SET-3   Data Structure
Question 8 Explanation:
 Question 9
The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is
 A A B B C C D D
ISRO CSE 2014   Data Structure
Question 9 Explanation:
 Question 10
Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?
 A A queue cannot be implemented using this stack. B A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions. C A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction D A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.
GATE CSE 2014 SET-2   Data Structure
Question 10 Explanation:
There are 10 questions to complete.