Multiple Choice
Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = -1;//Note top == -1 indicates stack is empty
A method that implements a void push(String x) operation can be written as
A) if (top == s.length-1)
Throw new RuntimeException("Overflow") ;
Top ++;
S[top] = x;
B) if (top == s.length.
Throw new RuntimeException("Overflow".;
Top ++;
S[top] = x;
C) if (top == s.length-1.
Throw new RuntimeException("Overflow".;
S[top] = x;
Top ++;
D) if (top == s.length.
Throw new RuntimeException("Overflow".;
S[top] = x;
Top ++;
Correct Answer:

Verified
Correct Answer:
Verified
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
Q25: 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
Q31: A queue based on a linked list