What is the value of the top element after these operations are executed?

You have a stack that contains integer values. The values are pushed onto the stack in the
following order: 2,4,6,8.
The following sequence of operations is executed:
Pop
Push 3
Pop
Push 4
Push 6
Push 7

Pop
Pop
Pop
What is the value of the top element after these operations are executed?

You have a stack that contains integer values. The values are pushed onto the stack in the
following order: 2,4,6,8.
The following sequence of operations is executed:
Pop
Push 3
Pop
Push 4
Push 6
Push 7

Pop
Pop
Pop
What is the value of the top element after these operations are executed?

A.
2

B.
3

C.
6

D.
7



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Thabang

Thabang

Answer is C.6

jeff

jeff

Answer is C.6

Serge

Serge

Tested is C.6

Stack numbers = new Stack();

numbers.Push(2);
numbers.Push(4);
numbers.Push(6);
numbers.Push(8);

numbers.Pop();
numbers.Push(3);
numbers.Pop();
numbers.Push(4);
numbers.Push(6);
numbers.Push(7);
numbers.Pop();
numbers.Pop();
numbers.Pop();

foreach (int n in numbers)
Console.WriteLine(n);

Alejandro Sepúlveda

Alejandro Sepúlveda

is 6!!!!

Cam Vale

Cam Vale

Answer is 6

2,4,6,8
Pop() 2,4,6
Push(3) 2,4,6,3
Pop() 2,4,6
Push(4) 2,4,6,4
Push(6) 2,4,6,4,6
Push(7) 2,4,6,4,6,7
Pop() 2,4,6,4,6
Pop() 2,4,6,4
Pop() 2,4,6

blah

blah

As everyone mentioned, its 6!