Multiple Choice
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = 0;
A method that implements the String pop() operation can be written as
A) if (top == 0)
Throw new RuntimeException("Underflow") ;
Top--;
String temp = s[top];
S[top] = null;
Return temp;
B) if (top == 0.
Throw new RuntimeException("Underflow".;
String temp = s[top];
Top--;
S[top] = null;
Return temp;
C) if (top == 0.
Throw new RuntimeException("Underflow".;
Return s[top-1];
Top --;
S[top] = null;
D) top--;
Return s[top];
Correct Answer:

Verified
Correct Answer:
Verified
Q20: The stack pop operation<br>A) removes all items
Q21: A stack based on a linked list
Q22: A stream of cars going through a
Q23: Consider a class that uses the following
Q24: A queue invariant is a condition<br>A) obeyed
Q26: Consider a class that uses the following
Q27: In a list implementation of a queue,the
Q28: A stack based on a linked list
Q29: In a queue implementation that uses an
Q30: Which of the following operations is not