You are developing an application that contains a class named TheaterCustomer and a method named
ProcessTheaterCustomer. The ProcessTheaterCustomer() method accepts a TheaterCustomer object as the
input parameter.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 to pass the objects to the ProcessTheaterCustomer() method.
Explanation:
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.
https://en.wikipedia.org/wiki/Stack_(abstract_data_type)
No one will visit your theater if you process your visitors in a stack. Questions like this are designed only to confuse.