exam questions

Exam 98-361 All Questions

View all questions & answers for the 98-361 exam

Exam 98-361 topic 1 question 16 discussion

Actual exam question from Microsoft's 98-361
Question #: 16
Topic #: 1
[All 98-361 Questions]

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
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Django
Highly Voted 5 years, 3 months ago
answer should be 6.
upvoted 28 times
...
seba1601
Highly Voted 4 years, 3 months ago
The answer is 6
upvoted 11 times
...
bugmenot240410
Most Recent 1 month, 3 weeks ago
Answer is 6 after tying in a simulator!
upvoted 1 times
...
abdaziz
2 years ago
The answer is 6 final result LIFO static void MyStack() { Stack myStack = new Stack(); myStack.Push(2); myStack.Push(4); myStack.Push(6); myStack.Push(8); ShowStack(myStack, "Initial Data Stack (LIFO)"); myStack.Pop(); ShowStack(myStack, "Deleted first"); myStack.Push(3); ShowStack(myStack, "Added 3"); myStack.Pop(); ShowStack(myStack, "Deleted first"); myStack.Push(4); ShowStack(myStack, "Added 4"); myStack.Push(6); ShowStack(myStack, "Added 6"); myStack.Push(7); ShowStack(myStack, "Added 7"); myStack.Pop(); myStack.Pop(); myStack.Pop(); ShowStack(myStack, "Deleted third"); ShowStack(myStack, "Final Result"); Console.ReadLine(); }
upvoted 1 times
...
Oryza
2 years ago
it's "6", I tried on C# : static void TestStack() { System.Collections.Stack stack = new System.Collections.Stack(); stack.Push(2); stack.Push(4); stack.Push(6); stack.Push(8); stack.Pop(); stack.Push(3); stack.Pop(); stack.Push(4); stack.Push(6); stack.Push(7); stack.Pop(); stack.Pop(); stack.Pop(); Console.WriteLine(stack.Peek()); }
upvoted 1 times
...
Janus1986
2 years, 1 month ago
using System; using System.Collections; namespace StackTest{ class Test { static void Main(String[] args){ Stack st = new Stack(); st.Push(2); st.Push(4); st.Push(6); st.Push(8); Console.WriteLine(); Console.Write("Stack = "); foreach (int ch in st) { Console.Write(ch + " "); } st.Pop(); st.Push(3); st.Pop(); st.Push(4); st.Push(6); st.Push(7); st.Pop(); st.Pop(); st.Pop(); Console.WriteLine(); Console.Write("Stack = "); foreach (int ch in st) { Console.Write(ch + " "); } } } }
upvoted 1 times
...
FedericoMita
2 years, 1 month ago
It goes as follows: 2,4,6,8 Pop 2,4,6 Push(3) 2,3,4,6 Pop 2,3,4 Push(4) 2,3,4 Push(6) 2,3,4,6 Push(7) 2,3,4,6,7 Pop 2,3,4,6 Pop 2,3,4 Pop 2,3 So the answer is 3.
upvoted 1 times
...
Lee_Schoefield
2 years, 5 months ago
Answer should be 6
upvoted 3 times
...
mr_sploit
2 years, 5 months ago
answer is 4 https://bigprogram.wordpress.com/stack-data-structure/
upvoted 1 times
...
AishwaryaGupta
3 years, 2 months ago
Answer is 6. 8642 3642 467642 642
upvoted 6 times
...
chewyfood
3 years, 7 months ago
answer is 4. Stacks are FILO
upvoted 1 times
AncientMonkey
3 years, 6 months ago
Stacks are not FILO, they are LIFO (Last In, First Out) so it should be 6.
upvoted 5 times
AncientMonkey
3 years, 6 months ago
Although, stacks can be FILO, but it is more commonly accepted as LIFO. Either way, the answer is 6
upvoted 3 times
...
...
...
thrive2vgrayt
3 years, 8 months ago
Is it FIFO? or FILO?
upvoted 1 times
...
SamarHussain
3 years, 8 months ago
Answer should be 4
upvoted 2 times
...
Rakesh_Nalawade
3 years, 11 months ago
Yes answer should be 6
upvoted 5 times
...
Boruc
4 years, 1 month ago
should be 6
upvoted 5 times
...
pauls
4 years, 3 months ago
I also Have answer as 6
upvoted 6 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago