Time Left - 15:00 mins

GATE 2024 Programming & Data Structures Rank Booster Quiz 28

Attempt now to get your rank among 36 students!

Question 1

Assume is power operator and it has the highest precedence and follows right associativity. The average length of the stack used to evaluate the given postfix expression is __________. (Upto 3 decimal places)

7 7 1 * 7 1 / + 7 – 7 +

Question 2

Given finite alphabet set = {p, q, r} and stack of size S, the three-stack operations are push(x) where element x is pushed into the stack, pop() deletes the element in top of stack and print() which prints the output.

The stack is initially empty and we do not perform pop( ) on an empty stack and the stack may or may not be empty finally. The minimum number of stack operations to get “p q r p r q p” as output is ______.

Question 3

Consider the sequence M,N,O,P,Q. Using stack data structure which of the following sequence(permutations) can be obtained in the same order assuming the sequence is in the given order.

Question 4

Convert the following expression from infix to postfix ?

a+b*c – d/ef*g+h

Question 5

Consider the following operation is performed on the stack as push(10), push(20), pop, push(10), push (20), pop, pop, pop, push (20), pop.

What is the output?

Question 6

Suppose each of push and pop operations on stack takes 1 unit of time and insert and delete operations on queue takes 2 units of time each. Assuming n elements are in a stack, find the minimum time to reverse the elements in a stack using queue?

Question 7

We have a queue and a stack which support an extra operation reverse(), reverse() can reverse the elements of stack. Now follow following instructions:-
1) Six elements p,q,r,s,t,u are inserted in a queue in the same order.
2) Delete 3 elements from queue and push them in the stack
3) Pop one element from stack and delete it
4) reverse() the stack elements
5) pop elements and insert them in the queue
Now which element is in the middle of the queue?
  • 36 attempts
  • 0 upvotes
  • 0 comments
Dec 13GATE & PSU CS