MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is caused 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: -A stack overflow is a type of buffer overflow error that occurs when a computer program tries to use more memory space in the call stack than has been allocated to that stack.

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: -It will cause a stack overflow, and how that is handled is also up to how you implemented your stack. Ideally, the stack implementation should know when it is at full capacity. When the stack is at capacity and a push is attempted, it will generally throw an exception and not attempt to add an element at all.

Detailed explanation-4: -StackOverflowError is a runtime error which points to serious problems that cannot be caught by an application. The java. lang. StackOverflowError indicates that the application stack is exhausted and is usually caused by deep or infinite recursion.

There is 1 question to complete.