MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In pop operation of stack if TOP=NULL then stack is ____
A
full
B
empty
C
half
D
all of above
Explanation: 

Detailed explanation-1: -Pop Operation : The pop operation is used to delete the topmost element from the stack. However, before deleting the value, we must first check if TOP=NULL because if that is the case, then it means the stack is empty and no more deletions can be done.

Detailed explanation-2: -Pop removes the top item from the stack and decrements the Count property by one. Pop generates an error if applied to an empty stack. Thus, it’s advisable to determine when a stack is empty by using the Count property before popping the stack.

Detailed explanation-3: -Stack is empty when the value of Top is –1.

Detailed explanation-4: -16. When a pop() operation is called on an empty queue, what is the condition called? Answer-B) pop() on an empty queue causes Underflow. 17.

Detailed explanation-5: -Underflow happens when we try to pop an item from an empty stack.

There is 1 question to complete.