exam questions

Exam 70-483 All Questions

View all questions & answers for the 70-483 exam

Exam 70-483 topic 2 question 118 discussion

Actual exam question from Microsoft's 70-483
Question #: 118
Topic #: 2
[All 70-483 Questions]

You are developing an application that contains a class named TheaterCustomer and a method named ProcessTheaterCustomer. The method accepts a TheaterCustomer object as the input parameter.
ProcessTheaterCustomer()
You have the following requirements:
✑ Store the TheaterCustomer objects in a collection.
✑ Ensure that the ProcessTheaterCustomer() method processes the TheaterCustomer objects in the reverse order in which they are placed into the collection.
You need to meet the requirements.
What should you do?

  • A. Create a System.Collections.Queue collection. Use the Enqueue() method to add TheaterCustomer objects to the collection. Use the Dequeue() method to pass the objects to the ProcessTheaterCustomer() method.
  • B. Create a System.Collections.ArrayList collection. Use the Insert() method to add TheaterCustomer objects to the collection. Use the Remove() method to pass the objects to the ProcessTheaterCustomer() method.
  • C. Create a System.Collections.Stack collection. Use the Push() method to add TheaterCustomer objects to the collection. Use the Pop() method to pass the objects to the ProcessTheaterCustomer() method.
  • D. Create a System.Collections.Queue collection. Use the Enqueue() method to add TheaterCustomer objects to the collection. Use the Peek() method
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
A stack is the appropriate collection here. In computer science, a stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the last element that was added.
Reference: https://en.wikipedia.org/wiki/Stack_(abstract_data_type)

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
Ben1999
Highly Voted 4 years, 7 months ago
Becuase we are processing the objects in reverse order we use Push and Pop
upvoted 6 times
...
afiqmehdizade
Most Recent 4 years, 7 months ago
why C?
upvoted 2 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 ...