Question:

Stack works on the principle of ________.

Updated On: May 28, 2025
  • Mid Element First
  • First In First Out
  • Last In First Out
  • Last In Last Out
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Approach Solution - 1

The correct principle that a stack operates on is Last In First Out (LIFO). This means that the last element added to the stack is the first one to be removed. This principle is often visualized using the analogy of a stack of plates where you can only add or remove the top plate. The stack data structure allows operations mainly at one end:

  • Push: Add an element to the top of the stack.
  • Pop: Remove the element from the top of the stack.

This ensures that the most recently added element is accessed first, adhering to the LIFO system.

Was this answer helpful?
0
0
Hide Solution
collegedunia
Verified By Collegedunia

Approach Solution -2

(1) Mid Element First: This is incorrect. Stacks do not operate on the principle of processing the middle element first.

(2) First In First Out: This describes a queue, not a stack. A queue processes elements in the order they were added.

(3) Last In First Out: This is the correct principle for a stack. The last element added (pushed) onto the stack is the first element removed (popped).

(4) Last In Last Out: This doesn't represent a standard data structure principle.

Therefore, a stack works on the principle of (3) Last In First Out.

Was this answer helpful?
0
0