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 pop() operation is
A) if (top != null)
{
Top = top.next;
String el = top.element;
Return el;
}
Else throw new RuntimeException("Empty Stack") ;
B) if (top != null.
{
String el = top.element;
Top = top.next;
Return el;
}
Else throw new RuntimeException("Empty Stack".;
C) if (top != null.
{
String el = top.element;
Top = null;
Return el;
}
Else throw new RuntimeException("Empty Stack".;
D) return top.element;
Top = top.next;
Correct Answer:

Verified
Correct Answer:
Verified
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
Q6: Consider a class that uses the following
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