What is the right code for String remove() operation? Such an operation removes and returns an element from the queue.

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;

```

A) ```
if (rear== null)
throw new RuntimeException("Empty");
String temp = rear.element;
rear = rear.next;
if (front == null)
rear = null;
return temp;

B) ```
if (front == rear)
throw new RuntimeException("Empty");
String temp = front.element;
front = front.next;
if (front == null)
rear = null;
return temp;

C) ```
if (front == null)
throw new RuntimeException("Empty");
String temp = front.element;
front = front.next;
if (front == null)
front = rear;
return temp;

```

D) ```
if (front == null)
throw new RuntimeException("Empty");
String temp = front.element;
front = front.next;
if (front == null)
rear = null;
return temp;

```

D) ```
if (front == null)
throw new RuntimeException("Empty");
String temp = front.element;
front = front.next;
if (front == null)
rear = null;
return temp;

```

Computer Science & Information Technology

You might also like to view...

What is the error in the following pseudocode?

``` Display "What is your name?" Input userName Declare String userName ``` a. userName is an invalid variable name. b. The Input statement should be the first statement. c. userName has been used before it is declared. d. There is no error.

Computer Science & Information Technology

Once a root certificate for a CA is installed, all other certificates issued by the same CA are not trusted.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology