Share
Explore BrainMass

C++ Queuing Systems for Objects

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

Attachments

Solution Preview

11. Answer: B
Overloaded assignment is a deep copy with O(n) time.
12. Answer: B
Pop
13. Answer: B
The ...

Solution Summary

The expert examines C++ queuing systems for objects. The overloaded assignments are determined.

$2.19