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 for adding an item x to the stack can be written as
A) s.add(top,x) ;
B) if (top == s.length.
Throw new RuntimeException("Overflow".;
Else
{
Top ++;
S[top] = x;
}
C) if (top < 0.throw new IndexOutBoundsException(.
S[top] = x;
Top ++;
D) if (top < s.length.
{
S[top] = x;
Top ++;
}
Else
Throw new RuntimeException("Overflow".;
Correct Answer:

Verified
Correct Answer:
Verified
Q4: The stack pull operation<br>A) increases the capacity
Q5: The stack peek operation<br>A) checks a stack
Q6: Consider a class that uses the following
Q7: A queue is a container that allows
Q8: Consider a class that uses the following
Q10: In an implementation of a stack based
Q11: A queue based on a linked list
Q12: In a list implementation of a stack,the
Q13: Compilers of modern programming languages support method
Q14: Consider a class that uses the following