MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In a stack, if a user tries to remove an element from empty stack it is called
A
empty collection
B
underflow
C
overflow
D
garbage collection
Explanation: 

Detailed explanation-1: -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.

Detailed explanation-2: -Explanation: Elements in the stack are removed using pop operation. Pop operation removes the top most element in the stack i.e. last entered element.

Detailed explanation-3: -When we remove the top item, that’s called a pop. Underflow happens when we try to pop an item from an empty stack.

Detailed explanation-4: -Explanation:In a Queue, if a user tries to remove an element from empty Queue it is called Underflow.

Detailed explanation-5: -D) Underflow-Trying to delete an element from a stack that is empty, leads to underflow.

There is 1 question to complete.