Chapter 14 Questions
d. able to easily add a node to the back/end of the chain
7. In class LinkedQueue, where does neNodePtr point?
a. the back or end of the chain
b. the front or beginning of the chain
c. nullPtr
d. the next element of the queue
8. In the class LinkedQueue, what must the peekFront method do before returning the value at
the front of the queue?
a. traverse the chain
b. check that the queue is not empty
c. remove the node at the beginning of the chain
d. establish a pointer to the beginning of the chain
9. What would be the purpose of the following lines of code?
back = (back + 1) % DEFAULT_CAPACITY;
items[back] = newEntry;
a. enables a circular linked list implementation of a queue
b. eliminates rightward drift
c. enables a circular array implementation of a queue
d. keeps a linked list from running out of memory
10. Which of the following elements of ArrayQueue is not private?
a. back
b. count
c. front
d. isEmpty()
11. How does the isEmpty method of ArrayQueue class return the proper value?
a. return count == 0;
b. return front != back
c. return front / back == 0
d. return count < DEFAULT_CAPACITY
12. The text defined a class SL_PriorityQueue. What command was used to accomplish the
enqueue method?
a. insert(newEntry);
b. insertSorted(newEntry);
c. push(newEntry);
d. addItem(newEntry);