Question 110 pts What are the contents of the queue bankLine after the following statements execute? The...

70.2K

Verified Solution

Question

Programming

Question 110 pts

What are the contents of the queue bankLine after the followingstatements execute? The front of the queue in the answers is theleft-most value

QueueInterface bankLine =newLinkedQueue<>();
bankLine .enqueue(“John”);
bankLine .enqueue(“Matthew”);
String next = bankLine .dequeue();
bankLine .enqueue(“Drew”);
bankLine .enqueue(“Heather”);
bankLine .enqueue(“David”);
next = bankLine .dequeue();

John, Drew, Heather
Heather, John, Drew
Drew, Heather, David
David, Heather, Drew

Flag this Question

Question 210 pts

What are the contents of the deque waitingLine after thefollowing statements execute? The front of the queue in the answersis the left-most value

DequeInterface waitingLine = newLinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.removeFront();

Larry, Sam, Jack
Rudy, Jack, Larry
Larry, Jack, Rudy
Jack, Larry, Sam

Flag this Question

Question 310 pts

How does a queue organize its items?

according to the order in which they were added
by priority
alphabetically
randomly

Flag this Question

Question 410 pts

The ADT priority queue organizes objects

according to the order in which they were added
by priority
alphabetically
none of the above

Flag this Question

Question 510 pts

What item is at the front of the list after these statements areexecuted?

DequeInterface waitingLine = newLinkedDeque<>();
waitingLine.addToFront(“Jack”);
waitingLine.addToFront(“Rudy”);
waitingLine.addToBack(“Larry”);
waitingLine.addToBack(“Sam”);
String name = waitingLine.getFront();

Jack
Rudy
Larry
Sam

Flag this Question

Question 610 pts

If we use a chain of linked nodes with only a head reference toimplement a queue, which statement is true?

You must traverse the entire chain to access the lastnode.
Accessing the last node is very inefficient.
Both a and b
None of the above

Flag this Question

Question 710 pts

In the linked chain implementation of a queue, the chain’s firstnode contains

the queue’s front entry
the queue’s back entry
both a and b
none of the above

Flag this Question

Question 810 pts

In a linked chain implementation of a queue, the performance ofthe enqueue operation is

O(1)
O(log n)
O(n)
O(n^2)

Flag this Question

Question 910 pts

In a linked chain implementation of a queue, the performance ofthe getFront operation is

O(1)
O(log n)
O(n)
O(n^2)

Flag this Question

Question 1010 pts

In a circular array-based implementation of a queue, what is theperformance when the enqueue operation must resize the array?

O(n^2)
O(n)
O(log n)
O(1)

Answer & Explanation Solved by verified expert
4.2 Ratings (505 Votes)
The answer to the question is givenbelowThe answer to the 12    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students