Stack: GATE CS Previous Year Questions

Stack · Data Structures

13 questions · asked in 8 of 27 years (2000–2026)

MCQ 10 · MSQ 2 · NAT 11-mark 11 · 2-mark 2

2000Questions per year2026

Questions 6–10 of 13

Q6GATE 20071 markMCQ−0.33 if wrong
The following postfix expression with single digit operands is evaluated using a stack:

8 2 3 ^ / 2 3 * + 5 1 * -  
Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:

Q7GATE 20051 markMCQ−0.33 if wrong
A function ff defined on stacks of integers satisfies the following properties. f(∅)=0f(\emptyset) = 0 and f(push(S,i))=max(f(S),0)+if (push (S, i)) = max (f(S), 0) + i for all stacks SS and integers ii. If a stack SS contains the integers 2, -3, 2, -1, 2 in order from bottom to top, what is f(S)f(S)?

Q8GATE 20041 markMCQ−0.33 if wrong
A program attempts to generate as many permutations as possible of the string, 'abcd' by pushing the characters a,b,c,d in the same order onto a stack, but it may pop off the top character at any time. Which one of the following strings CANNOT be generated using this program?

Q9GATE 20041 markMCQ−0.33 if wrong
Assume that the operators +, -, x , are left associative and ^ is right associative. the order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix expression a + b x c-d^e^f is

Q10GATE 20041 markMCQ−0.33 if wrong
The best data structure to check whether an arithmetic expression has balanced parentheses is a

Keep practising

Topics in Data Structures

All CS topics ›