what item is at the front of the list after these statements are executed?

DequeInterface waitingLine= new LinkedDeque<>();

WaitingLine.addToFront("Jack");

WaitingLine.addTolBack("Rudy");

WaitingLine.addToBack("Larry");

WaitingLine.addTolFront("sam");

name =getBack();

WaitingLine.addtoBack("Adam");

A.sam B. Adam. C. Rudy. D. Jack E. all other answers

Respuesta :

Answer:

A.Sam.

Explanation:

We are using Deque interface which is sub type of  Queue interface. Deque supports insertion and deletion from both ends front and end.So it can be used as a queue and stack also.

In this question we have inserted Jack at the front first.Then Rudy at the back then larry also at the tail.Now we have added sam at the front then nothing is added to the front.So the answer is Sam.