Which of the following condition occurs, if one tries to insert an element in already full stack?
Which of the following condition occurs, if one tries to insert an element in already full stack?
Solution
✅ Correct Option: 2
Pushing an element onto a stack that has no free space is called overflow. The stack has a fixed capacity (for example, an array of size ), so once the top reaches the last position, no more elements can be added.
Option 1: Underflow is the opposite case, where pop is attempted on an empty stack.
Option 3: A well-written program checks for overflow and reports an error rather than crashing.
Option 4: Overflow happens at run time, not at compile time, so the program still compiles.
Related questions:
2025: 15 May Shift 2
2026: 23 May Shift 1
2025: 30 May Shift 2
2025: 14 May Shift 1