Complete the mcq:
1 An effective way to implement a priority queue is to use a(n) ____ structure.
stack
array
varied
treelike
2 //Program to test the queue operations
#include
#include "linkedList.h"
#include "queueLinked.h"
using namespace std;
int main()
{
linkedQueueType queue;
linkedQueueType copyQueue;
int num;
cout<<"Queue Operations"< cout<<"Enter numbers ending with -999"< cin>>num;
while(num != -999)
{
queue.addQueue(num); //add an element to the queue
cin>>num;
}
copyQueue = queue; //copy the queue into copyQueue
cout<<"Queue contains: ";
while(!copyQueue.isEmptyQueue())
{
cout< copyQueue.deleteQueue(); //remove an element from
//the queue
}
cout<
return 0;
}
Based on the figure above, if you wanted to print out the contents of copyQueue in reverse order, which statement would do the job?
cout<
cout<
cout<
cout<
3 One way to implement a priority queue is to use an ordinary ____.
linked-list
array
stack
list
4 FIFO closely resembles which of the following?
the order in which print jobs of the same priority are executed by a printer
the order in which customers are serviced in a bank
the order in which shoppers are serviced on line to pay for their items
All of the above
5 Refer to the figure above. Which of the following members in the UML diagram keeps track of the number of elements in a queue at a given point in time?
maxQueueSize
isFullQueue
count
num
6 The function destroyQueue does which of the following?
uses one queue to delete another
deletes all instances of the queue
copies the queue into backup memory
removes all elements from the queue leaving an empty queue
7 In a queuing system the time it takes for the server to serve the customer is known as the ____ time.
initiation
transaction
response
wait
8 //Program to test the queue operations
#include
#include "linkedList.h"
#include "queueLinked.h"
using namespace std;
int main()
{
linkedQueueType queue;
linkedQueueType copyQueue;
int num;
cout<<"Queue Operations"< cout<<"Enter numbers ending with -999"< cin>>num;
while(num != -999)
{
queue.addQueue(num); //add an element to the queue
cin>>num;
}
copyQueue = queue; //copy the queue into copyQueue
cout<<"Queue contains: ";
while(!copyQueue.isEmptyQueue())
{
cout< copyQueue.deleteQueue(); //remove an element from
//the queue
}
cout<
return 0;
}
Refer to the figure above. Assume you add the numbers 23, 76, 64 in this order. The output of the program will be which of the following?
Queue contains: 64 76 23
Queue contains: 23 76 64
Queue contains: 23 64 76
Queue contains: 76 64 23
9 The function addQueue does which of the following?
adds all the contents from one queue to another
appends one queue to the back of another
adds a new element to the front of the queue
adds a new element to the rear of the queue