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 ___________.
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 ___________.
94 | |
83 | |
79 | |
86 |
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.
Which of the following will initialize an empty stack with capacity N for the above implementation?
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?
\text { pos } \leftarrow-1 | |
\text { pos } \leftarrow 0 | |
\text { pos } \leftarrow 1 | |
\text { pos } \leftarrow N-1 |
Question 2 Explanation:
Question 3 |
Convert the pre-fix expression to in-fix -^{*}+A B C^{*}-D E+F G
(A-B)^{*} C+\left(D^{*} E\right)-(F+G) | |
(A+B)^{*} C-(D-E)^{*}(F-G) | |
(A+B-C)^{*}(D-E)^{*}(F+G) | |
(((A+B)*C)-((D-E)*(F+G))) |
Question 3 Explanation:
Originally all Options are wrong. We have modified one option.
Click here for detail solution by gateoverflow
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+(b-c))^{\star}((d-e) /(f+g-h))
{ }^{\star}+a-b c /-d e-+f g h | |
{ }^{\star}+a-b c -/d e-+f g h | |
{ }^{\star}+a-b c /-ed-+f g h | |
{ }^{*}+\mathrm{ab}-\mathrm{c} /-\mathrm{de}-+\mathrm{fgh} |
Question 4 Explanation:
Question 5 |
The best data structure to check whether an arithmetic expression has balanced parenthesis is a:
Queue | |
Stack | |
Tree | |
List |
Question 5 Explanation:
There are 5 questions to complete.