Consider a class that uses the following variables to implement an array-based stack:
String [ ] s = new String[100];
Int top = 0;
The boolean method to check for an empty stack can be written as:
A) return top;
B) if (top == 0.
Return true;
Else
Return false;
C) if (s == null.
Return true;
Else
Return false;
D) if
Return true;
Else
Return false;
Correct Answer:
Verified
Q11: The stack push operation
A) is normally implemented
Q12: A stack is a container that allows
Q13: In a list implementation of a queue,the
Q14: A stream of cars going through a
Q15: Consider a class that uses the following
Q17: Consider a class that uses the following
Q18: The stack pop operation
A) removes all items
Q19: In an array-based implementation of a stack,an
Q20: The stack peek operation
A) checks a stack
Q21: A stack based on a linked list
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents