Which of the following operations is not possible in a stack ?

2025

Which of the following operations is not possible in a stack ?

  1. A.

    Push

  2. B.

    Pop

  3. C.

    Peek

  4. D.

    Delete from the middle

Attempted by 332 students.

Show answer & explanation

Correct answer: D

A stack is a linear data structure that operates on the Last-In-First-Out (LIFO) principle, meaning the last element added is the first one removed. The fundamental operations supported by a stack include Push (adding an element to the top), Pop (removing the top element), and Peek or Top (viewing the top element without removing it). These operations strictly adhere to accessing only the most recently added item. Deleting an element from the middle of a stack is not possible because it would violate the LIFO access pattern. To remove an element from the middle, one would need to pop all elements above it first, which fundamentally alters the stack's state and is not considered a direct operation. Therefore, while Push, Pop, and Peek are standard stack operations, deleting from the middle is not supported.

Explore the full course: Niacl Ao It Specialist