What is the operation emptystack return


Complete the mcq:

Question 1

What would the operation isEmptyStack return if applied to the stack above?

0

5

true

false

1141_Stack.jpg

Question 2

template
void stackType::operation1(const Type& newItem)
{
if(!isFullStack())
{
list[stackTop] = newItem;
stackTop++;
}
else
cerr<<"Cannot add to a full stack."<}

Which stack operation does operation1 above define?

top

pop

push

initializeStack

Question 3

Stack s;

s.push(3);
s.push(7);
x = s.pop();
s.push(5);
y = s.pop();
z = s.pop();

Given the sequence of operations above, what is the value of x?

0

3

5

7

Question 4

Given the sequence of operations above, what is the value of z?


0

3

5

7

Question 5

1141_Stack.jpg

If you applied the operation pop to the stack above, which book would be left on top of the stack?

Applied Math

World History

Chemistry

English

Question 6

What is the effect of the operation empty of the stack container class?

To empty the stack

Return the number of items in the stack

Return true if the stack is empty and false otherwise

Return true if the stack is nonempty and false otherwise

Question 7

Which operation would you use to return the Applied Math book from the stack above?

top

pop

push

return

1141_Stack.jpg

Question 8

What is the value of the postfix expression: 5 4 * 3 + ?

17

23

27

35

Question 9

What is the equivalent postfix expression for the infix expression: (x - y) * (v + w)?

x v * y w - +

- x y + v w *

x * y + v * w -

x y - v w + *

Question 10

#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 1 above?

18 21 25

21 18 25

25 21 18

25 18 21

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: What is the operation emptystack return
Reference No:- TGS01937637

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)