In a stack, if a user tries to remove an element from empty stack it is called ?
A.
Underflow
B.
Empty collection
C.
Overflow
D.
Garbage Collection
Answer: Option A
Explanation:
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.
Pushing an element into stack already having five elements and stack size of 5, then stack becomes ?
A.
Overflow
B.
Crash
C.
Underflow
D.
User flow
Answer: Option A
Explanation:
The stack is filled with 5 elements and pushing one more element causes a stack overflow. This results in overwriting memory, code and loss of unsaved work on the computer.