Data Structures · Previous year questions
Stacks and Queues
14 questions from GATE CS 2012 to 2026, newest first.
Questions
GATE CS 2026 Set 2, Q.50
Consider a stack and a queue . Both of them are initially empty and have the capacity to store ten elements each. The elements 1, 2, 3, 4, and 5 arrive one by one, in tha...
Stacks and Queues
GATE CS 2025 Set 2, Q.45
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 that all keys are distinct. We...
Stacks and Queues
GATE CS 2024 Set 2, Q.48
Let
S1andS2be two stacks.S1has capacity of 4 elements.S2has capacity of 2 elements.S1already has 4 elements: 100, 200, 300, and 400, whereasS2is empty, as...Stacks and Queues
GATE CS 2023, Q.59
Consider a sequence of elements , and . The following operations are performed on a stack and a queue , both of...
Stacks and Queues
GATE CS 2022, Q.62
Consider the queues Q1 containing four elements and Q2 containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are Enqueue(Q,...
Stacks and Queues
GATE CS 2021 Set 1, Q.31 (CS Q.21)
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...Stacks and Queues
GATE CS 2018, Q.13 (CS Q.3)
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 the number of nodes in the...
Stacks and Queues
GATE CS 2017 Set 2, Q.13 (CS Q.13)
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two exte...
Stacks and Queues · Arrays and Linked Lists
GATE CS 2016 Set 1, Q.20 (CS Q.10)
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT ( refers to the num...
Stacks and Queues
GATE CS 2016 Set 1, Q.51 (CS Q.41)
Let denote a queue containing sixteen numbers and be an empty stack. returns the element at the head of the queue without removing it from . Simi...
Stacks and Queues
GATE CS 2015 Set 3, Q.22 (CS Q.12)
The result evaluating the postfix expression is
Stacks and Queues
GATE CS 2014 Set 2, Q.51 (CS Q.41)
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...
Stacks and Queues
GATE CS 2013, Q.44 (CS Q.44)
Consider the following operation along with Enqueue and Dequeue operations on queues, where is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty) and...
Stacks and Queues
GATE CS 2012, Q.35 (CS Q.35)
Suppose a circular queue of capacity () elements is implemented with an array of elements. Assume that the insertion and deletion operations are carried out using REA...
Stacks and Queues