C++ Queuing Systems for Objects
Not what you're looking for?
C++. See attached file for full problem description.
Question 11
What is the time-complexity of the overloaded assignment operator?
O(1)
O(n)
O(log n)
O(n^2)
Question 12
template<class Type>
void linkedStackType<Type>::linkedOperation1()
{
nodeType<Type> *temp;
if(stackTop!=NULL)
{
temp=stackTop;
stackTop=stackTop->link;
delete temp;
}
else
cerr<<"ERROR"<<endl;
}
Which stack operation is defined by linkedOperation1 above?
push
pop
top
copy
Question 13
template<class Type>
void linkedStackType<Type>::linkedOperation1()
{
nodeType<Type> *temp;
if(stackTop!=NULL)
{
temp=stackTop;
stackTop=stackTop->link;
delete temp;
}
else
cerr<<"ERROR"<<endl;
}
What does it mean if stackTop equals NULL in the operation above?
The stack is full
The stack is empty
The element does not exist
The stack is nonempty but not full
Question 14
In a linear representation of a stack, which of the following values points to the top item in the stack?
stackTop
stackTop - 1
0
-1
Question 15
#include <iostream>
#include "myStack.h"
using namespace std;
int main()
{
stackType<int> intStack(50);
stackType<int> tempStack;
intStack.push(18);
intStack.push(21);
intStack.push(25);
tempStack = intStack;
while(!tempStack.isEmptyStack())
{
cout<<tempStack.top()<<""; //output 1
tempStack.pop();
}
cout<<endl;
cout<<intStack.top()<<endl; //output 2
return 0;
}
What is output 2 above?
18
21
25
50
Question 16
template<class Type>
Type stackType<Type>::operation2()
{
assert(stackTop != 0);
return list[stackTop - 1];
}
Which stack operation is defined by operation2 above?
top
pop
push
isEmptyStack
Question 17
____ pointer(s) are needed to keep track of the front and rear of the queue.
Two
Three
Four
Five
Question 18
In the STL class queue the ____ function returns the number of elements in the queue.
num
count
sizeOf
size
Question 19
A technique in which one system models the behavior of another system is called ____.
modulation
comparison
analysis
simulation
Question 20
In queuing systems, queues of objects are waiting to be served by various ____.
operations
lists
customers
servers
Purchase this Solution
Solution Summary
The expert examines C++ queuing systems for objects. The overloaded assignments are determined.
Solution Preview
11. Answer: B
Overloaded assignment is a deep copy with O(n) time.
12. Answer: B
Pop
13. Answer: B
The ...
Purchase this Solution
Free BrainMass Quizzes
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
C# variables and classes
This quiz contains questions about C# classes and variables.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
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.