Practice mode Data Structures

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.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.