Multiple Choice
A queue based on a linked list uses the following code
Class Node{
String element;
Node next;
Node (String el,Node n) {
Element = el;
Next = n;
}
}
Node front = null,rear = null;
What is the right code for void add(String x) operation? Such an operation adds x to the queue
A) rear = new Node(x,null) ;
B) rear = new Node(x,null.;rear = rear.next;
C) if (rear != null.
{
Rear.next = new Node(x,null.;
Rear = rear.next;
}
Else
{
Rear = new Node(x,null.;
Front = rear;
}
D) if (rear != null.
{
Rear.next = new Node(x,null.;
Rear = rear.next;
}
Else
{
Rear.next = new Node(x,null.;
Front = rear;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q26: Consider a class that uses the following
Q27: In a list implementation of a queue,the
Q28: A stack based on a linked list
Q29: In a queue implementation that uses an
Q30: Which of the following operations is not
Q31: A queue based on a linked list
Q32: The stack push operation<br>A) is normally implemented
Q33: The stack class provided by the Java
Q34: The operation for adding an item to
Q35: The stack empty operation<br>A) removes all elements