Question: 1. A list method E remove(int index) designed to remove and return the element at the given index should throw IndexOutOfBoundsException when a. the index
1. A list method E remove(int index) designed to remove and return the element at the given index should throw IndexOutOfBoundsException when
| a. the index is 0 | |
| b.the index is negative, or is greater than, or equal to, the size of the list | |
| c. | the index is negative, and greater than the size of the list |
| d. | the index is negative, or is greater than the size of the list |
2. A Node class for a linked list that can hold elements of type Object can be declared to have fields
| a. Object element; Node next; |
| b. Object element; next element; |
| c. Object element; |
| d. Object element; Node *next; |
3. The stack push operation
| a. removes and returns an item from the stack | |
| b. returns the item at the top of the stack, but does not remove it | |
| c. adds a single item to the stack | |
| d. is normally implemented through a hash set |
4.The stack peek operation
| a. | checks a stack to see if there are any elements in it |
| b. | returns the item at the top of the stack, but does not remove it |
| c. | removes and returns an item from the stack |
| d. | adds a single item to the stack |
5.The stack empty operation
| a. | checks to see if there is at least one item on the stack |
| b.destroys the stack and creates a new empty one in its place | |
| c. | removes all elements from the stack |
| d. | None of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
