Skip to main contentSkip to solution

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 nn), 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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question