Top MCQs on Stack Data Structure with Answers

Last Updated :
Discuss
Comments

Question 1

The best data structure to check whether an arithmetic expression has balanced parenthesis is a

  • Queue

  • Stack

  • Tree

  • List

Question 2

The minimum number of stacks needed to implement a queue is

  • 3

  • 1

  • 2

  • 4

Question 3

The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is

  • A

  • B

  • C

  • D

Question 4

Stack A has the entries a, b, c (with a on top). Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of the stack B can be only be printed. In this arrangement, which of the following permutations of a, b, c are not possible?

  • b a c

  • b c a

  • c a b

  • a b c

Question 5

The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is

  • A

  • B

  • C

  • D

Question 6

Which one of the following is an application of Stack Data Structure?
  • Managing function calls
  • The stock span problem
  • Arithmetic expression evaluation
  • All of the above

Question 7

Which of the following is true about linked list implementation of stack?
  • In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
  • In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
  • Both of the above
  • None of the above

Question 8

Consider the following sequence of operations on an empty stack.

Push(54);push(52);pop();push(55);push(62);s=pop(); 

Consider the following sequence of operations on an empty queue.

enqueue(21);enqueue(24);dequeue();enqueue(28);enqueue(32);q=dequeue(); 

The value of s+q is ___________.

  • 86

  • 68

  • 24

  • 94

Question 9

Convert the following infix expression into its equivalent post fix expression (A + B^ D) / (E – F) + G
  • ABD^ + EF – / G+
  • ABD + ^EF – / G+
  • ABD + ^EF / – G+
  • ABD^ + EF / – G+

Question 10

Which of the following is not an inherent application of stack?

  • Implementation of recursion

  • Evaluation of a postfix expression

  • Job scheduling

  • Reverse a string

There are 30 questions to complete.

Take a part in the ongoing discussion