Question: public interface Queue { /** * Returns the number of elements in the queue. */ int size(); /** * Tests whether the queue is empty.
public interface Queue{ /** * Returns the number of elements in the queue. */ int size(); /** * Tests whether the queue is empty. */ boolean isEmpty(); /** * Inserts an element at the rear of the queue. */ void enqueue(Object e); /** * Returns, but does not remove, the first element of the queue, or null if the queue is empty */ E first(); /** * Removes and returns the first element of the queue, or null if the queue is empty */ E dequeue(); }
Consider the following sequence of operations on a Queue that begins empty. Give the return value for each line. If it causes an error, then write ERROR.
enqueue("A") B C
enqueue("B")
dequeue() // FIRST
first() // SECOND
enqueue("C")
dequeue() // THIRD
dequeue() // FOURTH
dequeue() // FIFTH
Group of answer choices
FIRST
[ Choose ] true null B A false C
SECOND
[ Choose ] true null B A false C
THIRD
[ Choose ] true null B A false C
FOURTH
[ Choose ] true null B A false C
FIFTH
[ Choose ] true null B A false C
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
