In: Computer Science
Question 110 pts
What are the contents of the queue bankLine after the following
statements execute?...
Question 110 pts
What are the contents of the queue bankLine after the following
statements execute? The front of the queue in the answers is the
left-most value
QueueInterface<String> bankLine =
newLinkedQueue<>();
bankLine .enqueue(“John”);
bankLine .enqueue(“Matthew”);
String next = bankLine .dequeue();
bankLine .enqueue(“Drew”);
bankLine .enqueue(“Heather”);
bankLine .enqueue(“David”);
next = bankLine .dequeue();
Flag this Question
Question 210 pts
What are the contents of the deque waitingLine after the
following statements execute? The front of the queue in the answers
is the left-most value
DequeInterface<String> waitingLine = new
LinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.removeFront();
Flag this Question
Question 310 pts
How does a queue organize its items?
|
according to the order in which they were added |
Flag this Question
Question 410 pts
The ADT priority queue organizes objects
|
according to the order in which they were added |
Flag this Question
Question 510 pts
What item is at the front of the list after these statements are
executed?
DequeInterface<String> waitingLine = new
LinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.getFront();
Flag this Question
Question 610 pts
If we use a chain of linked nodes with only a head reference to
implement a queue, which statement is true?
|
You must traverse the entire chain to access the last
node. |
|
Accessing the last node is very inefficient. |
Flag this Question
Question 710 pts
In the linked chain implementation of a queue, the chain’s first
node contains
Flag this Question
Question 810 pts
In a linked chain implementation of a queue, the performance of
the enqueue operation is
Flag this Question
Question 910 pts
In a linked chain implementation of a queue, the performance of
the getFront operation is
Flag this Question
Question 1010 pts
In a circular array-based implementation of a queue, what is the
performance when the enqueue operation must resize the array?