Multiple Choice
A stack based on a linked list is based on the following code
Class Node{
String element;
Node next;
Node(String el,Node n) {
Element = el;
Next = n;
}
}
Node top = null;
The code for implementing the String peek() operation is
A) String temp = top.element;
If (temp != null) return temp;
Else
Throw new RuntimeException("Empty Stack") ;
B) if (top != null.
Return top.element;
Else return top.next;
C) if (top != null.
Return top.element
Else
Throw new RuntimeException("Empty Stack".;
D) if (top != null.
Return top;
Correct Answer:

Verified
Correct Answer:
Verified
Q13: Compilers of modern programming languages support method
Q14: Consider a class that uses the following
Q15: In an array-based implementation of a stack,an
Q16: The JCF Stack class is used to
Q17: A stack is a container that allows
Q19: The operation for removing an item from
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