C++ Functions and Responses
Not what you're looking for?
C++. See attached file for full problem description.
Question 21
Refer to the figure above. Which of the following members in the UML diagram adds an element to the front of the queue?
front
addQueue
back
None of the above
Question 22
An effective way to implement a priority queue is to use a(n) ____ structure.
stack
array
varied
treelike
Question 23
//Program to test the queue operations
#include <iostream>
#include "linkedList.h"
#include "queueLinked.h"
using namespace std;
int main()
{
linkedQueueType<int> queue;
linkedQueueType<int> copyQueue;
int num;
cout<<"Queue Operations"<<endl;
cout<<"Enter numbers ending with -999"<<endl;
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.front()<<" ";
copyQueue.deleteQueue(); //remove an element from
//the queue
}
cout<<endl;
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<<copyQueue.front();
cout<<copyQueue.back();
cout<<copyQueue.remove();
cout<<copyQueue.addQueue();
Question 24
One way to implement a priority queue is to use an ordinary ____.
linked-list
array
stack
list
Question 25
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
Question 26
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
Question 27
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
Question 28
In a queuing system the time it takes for the server to serve the customer is known as the ____ time.
initiation
transaction
response
wait
Question 29
//Program to test the queue operations
#include <iostream>
#include "linkedList.h"
#include "queueLinked.h"
using namespace std;
int main()
{
linkedQueueType<int> queue;
linkedQueueType<int> copyQueue;
int num;
cout<<"Queue Operations"<<endl;
cout<<"Enter numbers ending with -999"<<endl;
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.front()<<" ";
copyQueue.deleteQueue(); //remove an element from
//the queue
}
cout<<endl;
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
Question 30
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
Purchase this Solution
Solution Summary
The expert examines C++ functions and responses. The members in the UML diagrams which add an element to the front of the queue is determined.
Purchase this Solution
Free BrainMass Quizzes
Basic Computer Terms
We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.