+1 vote
in Data Structures & Algorithms I by (110k points)
In a stack, if a user tries to remove an element from an empty stack it is called _________

(a) Underflow

(b) Empty collection

(c) Overflow

(d) Garbage Collection

The above asked question is from Stack Operations topic in section Abstract Data Types of Data Structures & Algorithms I

This question was addressed to me in a job interview.

1 Answer

+1 vote
by (412k points)
selected by
Best answer
Right choice is (a) Underflow

The best I can explain: Underflow occurs when the user performs a pop operation on an empty stack. Overflow occurs when the stack is full and the user performs a push operation. Garbage Collection is used to recover the memory occupied by objects that are no longer used.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.