63.3k views
2 votes
For a data structure, such as a stack, who is responsible for throwing an exception if the stack is empty and a pop() is called:______.A. Application User.B. Data Structure Programmer.C. No one, you don't thow an exception in this case.D. End User Programmer.

User Mystical
by
6.8k points

1 Answer

2 votes

Answer:

D. End-User Programmer.

Step-by-step explanation:

A stack data structure is used to holds data for programs. The first data to go into a stack is always the last to be extracted (First-in-Last-out). Data is read into the stack with the push function and retrieved with the pop function.

When the stack is empty, it means there are no data left to pop from it. If a pop function is issued at this time, the program conventionally throws an error, there is no need for the end-user to write an exception handler for it because the end-user programmer has done that already.

User Shikha Thakur
by
7.5k points