In a Stack data structure, the <code>Push</code> operation inserts a new element at which position?
A
Solve 5+ Stacks, Queues and Deques practice questions for GATE DA with answers and detailed solutions. Free sample questions below.
A Stack is a linear data structure that follows a particular order in which operations are performed. The order may be LIFO (Last In First Out) or FILO (First In Last Out).
Imagine a stack of books on a table:
To access Book A, you must first remove Book C, then Book B. The last item added (C) is the first one removed.
In a Stack data structure, the <code>Push</code> operation inserts a new element at which position?
A
Which stack operation removes and returns the topmost element?
C
Push: Adds an element to the top. Does not remove.
- Peek (or Top): Returns the top element without removing it.
- Pop: Removes the top element and returns it.
- IsEmpty: Checks whether the stack is empty. Returns a boolean.
Step 2: The question asks for the operation that both removes and returns. Only Pop does both.
Answer: Option C
The access principle followed by a Stack data structure is called LIFO. What does LIFO stand for?
B
Key idea: This is a definition recall question, recognizable because it directly asks for the expansion of the acronym LIFO associated with stacks.
Step 1: Recall that a Stack follows the Last In, First Out principle. The most recently added element is the first one to be removed.
Step 2: Match this to the options. "Last In, First Out" is the correct expansion.
Answer: Option B
A stack contains the elements from bottom to top. Which element(s) can be directly accessed without removing any other element?
D
An empty stack undergoes the following operations in order: <code>Push(5)</code>, <code>Push(9)</code>, <code>Pop()</code>. What is the value of the top element after these operations?
B
Key idea: This is a basic stack trace question, recognizable because it gives a short sequence of Push and Pop operations and asks for the resulting top element.
Step 1: Start with an empty stack: .
Step 2: <code>Push(5)</code>: Add 5 to the top. . Top is 5.
Step 3: <code>Push(9)</code>: Add 9 to the top. . Top is 9.
Step 4: <code>Pop()</code>: Remove the top element (9). . Top is now 5.
Step 5: The top element after all operations is 5.
Answer: Option B
Solve 5+ Stacks, Queues and Deques practice questions for GATE DA with answers and detailed solutions. Free sample questions below.
Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.
Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.
Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.
We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.
Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.
Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.
Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.
No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.
Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.