Solved

What Is the Output of the Following Code? StackType<int> Stack;

Question 20

Multiple Choice

What is the output of the following code? stackType<int> stack;
Int x,y;
x = 5;
y = 3;
stack.push(4) ;
stack.push(x) ;
stack.push(x + 1) ;
y = stack.top() ;
stack.pop() ;
stack.push(x + y) ;
x = stack.top() ;
stack.pop() ;
cout << "x = " << x << endl;
cout << "y = " << y << endl;


A) x = 5
y = 6
B) x = 4
y = 3
C) x = 5
y = 3
D) x = 11
y = 6

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions