What is the condition called when a pop operation is attempted on an empty stack?
Correct answer B. Underflow
Explanation
Popping from an empty stack is underflow because there is nothing to remove. Overflow is the opposite case, a push onto a stack whose fixed-size storage is already full. Well-written stack implementations check for both, for example by testing whether top equals −1 before a pop and whether top equals capacity − 1 before a push.
Answer checked How we write and check questions
Discussion