Complete the mcq:
Q1 What is the time-complexity of the overloaded assignment operator?
O(1)
O(n)
O(log n)
O(n^2)
Q2 template
void linkedStackType::linkedOperation1()
{
nodeType *temp;
if(stackTop!=NULL)
{
temp=stackTop;
stackTop=stackTop->link;
delete temp;
}
else
cerr<<"ERROR"<}
Which stack operation is defined by linkedOperation1 above?
push
pop
top
copy
Q3 template
void linkedStackType::linkedOperation1()
{
nodeType *temp;
if(stackTop!=NULL)
{
temp=stackTop;
stackTop=stackTop->link;
delete temp;
}
else
cerr<<"ERROR"<}
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
Q4 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
Q5 #include
#include "myStack.h"
using namespace std;
int main()
{
stackType intStack(50);
stackType tempStack;
intStack.push(18);
intStack.push(21);
intStack.push(25);
tempStack = intStack;
while(!tempStack.isEmptyStack())
{
cout< tempStack.pop();
}
cout<
cout<
return 0;
}
What is output 2 above?
18
21
25
50
Q6 template
Type stackType::operation2()
{
assert(stackTop != 0);
return list[stackTop - 1];
}
Which stack operation is defined by operation2 above?
top
pop
push
isEmptyStack
Q7 ____ pointer(s) are needed to keep track of the front and rear of the queue.
Two
Three
Four
Five
Q8 In the STL class queue the ____ function returns the number of elements in the queue.
num
count
sizeOf
size
Q9 A technique in which one system models the behavior of another system is called ____.
modulation
comparison
analysis
simulation
Q10 In queuing systems, queues of objects are waiting to be served by various ____.
operations
lists
customers
servers