Which of the following data retrieval policy is followed by the stack?
2016
Which of the following data retrieval policy is followed by the stack?
- A.
non-sequence
- B.
last come, first out
- C.
last come, last out
- D.
first come, first out
Attempted by 169 students.
Show answer & explanation
Correct answer: B
The correct option is B (last come, first out).
A stack is a linear data structure that serves as a collection of elements, operating on a specific structural constraint for inserting and deleting data.
The Principle: It follows the LIFO (Last In, First Out) mechanism, which is phrased here as LCFO (Last Come, First Out). This means that the element added most recently to the stack will be the very first one to be removed.
Core Operations: 1. Push: Adds an item to the top of the stack. 2. Pop: Removes an item from the top of the stack.
Real-world Analogy: Think of a stack of dinner plates. You place a new plate on the top (Push), and when you need a plate, you take the top one off first (Pop). The plate that arrived last is the first one to leave.