52) If the sequence of operations- push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop, are performed on a stack, the sequence of popped out values are
Answer is:
2, 2, 1, 1, 2
Related Data structures and Algorithms MCQ with Answers
Answer is:
allocate resources (like CPU) by the operating system
Explanation:
Stacks cannot be used to allocate resources (like CPU) by the operating system.
However, stacks can be used for the other tasks listed:
- Stacks can be used to evaluate an arithmetic expression in postfix form by storing the operands in a stack and applying the operators in the correct order.
- Stacks can be used to implement recursion by storing the return addresses and local variables of each function call in a stack.
- Stacks can be used to convert a given arithmetic expression in infix form to its equivalent postfix form by applying the shunting yard algorithm or similar methods.
Answer is: