MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What will happen by attempting to push another item onto the top of a full stack?
A
Underflow error
B
Overload error
C
Overflow error
D
Catastrophic error
Explanation: 

Detailed explanation-1: -Overflow condition: When stack is completely full (i.e. TOP= MaxSize-1 ) and we try to insert more element onto stack then this condition is called overflow condition and no further element could be inserted now until any element is deleted.

Detailed explanation-2: -There are two possible errors that can be caused when pushing onto/popping from a stack: stack underflow-trying to pop an item from an empty stack. stack overflow-trying to push an item onto a full stack.

Detailed explanation-3: -When a stack overflow occurs, the excess data can corrupt other variables and address data, effectively changing variable values and overwriting return addresses. In some cases, this will cause the program to crash.

Detailed explanation-4: -The most-common cause of stack overflow is excessively deep or infinite recursion, in which a function calls itself so many times that the space needed to store the variables and information associated with each call is more than can fit on the stack.

There is 1 question to complete.