GATE Programming and Data Structures: Stacks and Queues – Previous Year Questions
14 GATE previous year questions on Stacks and Queues (Programming and Data Structures, Computer Science) with answers and explanations, from every paper.
14 questions worth 24 marks in all (4 1-mark, 10 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.
- GATE 2007 CS Q38 – Evaluate postfix expression with single-digit operands using a stack: is exponentiation. What are the top two stack elements after the first *?
- GATE 2015 CS (CS3) Q28 – Evaluate the postfix expression: 10 5 + 60 6 / * 8 − .
- GATE 2013 CS Q54 – Along with Enqueue/Dequeue, a queue supports MultiDequeue(Q), which sets m=k and repeatedly Dequeues while Q is nonempty and m>0, decrementing m. For…
- GATE 2012 CS Q45 – A circular queue stores at most n−1 items in an n-element array. REAR and FRONT index insertion/deletion positions and both start zero. Identify full…
- GATE 2014 CS (CS2) Q51 – A stack supports REVERSE (reverses all elements) in addition to PUSH and POP. Which is TRUE?
- GATE 2016 CS (CS1) Q20 – A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is…
- GATE 2016 CS (CS1) Q51 – Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it…
- GATE 2018 CS Q13 – A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote…
- GATE 2026 CS (CS2) Q50 – Consider a stack S and a queue Q, both initially empty and each capable of storing ten elements. The elements 1, 2, 3, 4, and 5 arrive one by one in…
- GATE 2025 CS (CS2) Q45 – Consider a stack data structure into which we can PUSH and POP records. Assume that each record pushed in the stack has a positive integer key and…
- GATE 2024 CS (CS2) Q48 – Let S1 and S2 be two stacks. S1 has capacity 4 and already holds 100, 200, 300, 400 (400 on top). S2 has capacity 2 and is empty. Operations: PushToS2…
- GATE 2023 CS Q59 – Consider a sequence a of elements a 0 = 1, a 1 = 5, a 2 = 7, a 3 = 8, a 4 = 9, and a 5 = 2. The following operations are performed on a stack S and a…
- GATE 2022 CS Q62 – Consider the queues Q 1 containing four elements (1, 2, 3, 4 with 1 at the head) and Q 2 containing none (shown as the Initial State in the figure).…
- GATE 2021 CS (CS1) Q31 – Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62); s = pop(); Consider the following…