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 String pop() operation can be written as
A) if (top == -1)
Throw new RuntimeException("Empty Stack") ;
Top --;
String temp = s[top];
S[top] = null;
Return temp;
B) if (top == -1.
Throw new RuntimeException("Empty Stack".;
S[top] = null;
Top--;
Return s[top ];
C) if (top == -1.
Throw new RuntimeException("Empty Stack".;
String temp = s[top];
S[top] = null;
Top--;
Return temp;
D) None of the above
Correct Answer:

Verified
Correct Answer:
Verified
Q1: A stack based on a linked list
Q2: A queue based on a linked list
Q3: In a list implementation of a queue,the
Q4: The stack pull operation<br>A) increases the capacity
Q5: The stack peek operation<br>A) checks a stack
Q7: A queue is a container that allows
Q8: Consider a class that uses the following
Q9: Consider a class that uses the following
Q10: In an implementation of a stack based
Q11: A queue based on a linked list