Question: (Multiple choice) The statement (setting the top element equal to the second element) in a client program of the stack class 1. would cause a
(Multiple choice) The statement
![stack.items [0] = stack.items [1];](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1706/7/0/0/84465ba302ca73531706700843849.jpg)
(setting the top element equal to the second element) in a client program of the stack class 1. would cause a syntax error at compile time.
2. would cause a run-time error.
3. would not be considered an error by the computer, but would violate the encapsulation of the stack data type.
4. would be a perfectly legal and appropriate way to accomplish the intended task.
stack.items [0] = stack.items [1];
Step by Step Solution
3.42 Rating (155 Votes )
There are 3 Steps involved in it
The statement stackitems0 stackitems1 in a client program of the stack class is atte... View full answer
Get step-by-step solutions from verified subject matter experts
