# 500+ Application Of Stacks MCQs with FREE PDF

These Application Of Stacks MCQs will give you a complete explanation of how to do decimal to binary using stacks, towers of hanoi, expression evaluation of infix, prefix and postfix, conversions like infix to postfix, postfix to infix, prefix to infix and infix to prefix conversions, reversing the word using stack and balanced parenthesis. We have the best collection of the Application Of Stacks MCQs and answer with FREE PDF. These Application Of Stacks MCQs will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.

## Application Of Stacks MCQs

#### 1. Which application of stack is used to ensure that the pair of parentheses is properly nested?

a) Balancing symbols

b) Reversing a stack

c) Conversion of an infix to postfix expression

d) Conversion of an infix to prefix expression

#### 2. In balancing parentheses algorithm, the string is read from?

a) right to left

b) left to right

c) center to right

d) center to left

Answer: left to right

a) stack

b) queue

c) tree

d) graph

#### 4. Which of the following does the balancing symbols algorithm include?

a) balancing double quotes

b) balancing single quotes

c) balancing operators and brackets

d) balancing parentheses, brackets and braces

Answer: balancing parentheses, brackets and braces

a) {[()]}

b) ([ )]

c) {( )}

d) { [ ] }

#### 6. What should be done when an opening parentheses is read in a balancing symbols algorithm?

a) push it on to the stack

b) throw an error

c) ignore the parentheses

d) pop the stack

Answer: push it on to the stack

#### 7. When the corresponding end bracket/braces/parentheses is not found, what happens?

a) The stack is popped

b) Ignore the parentheses

c) An error is reported

d) It is treated as an exception

Answer: An error is reported

100+ Balanced Parenthesis Question and Answer with FREE PDF

#### 8. Which is the predefined method available in Java to convert decimal to binary numbers?

a) toBinaryInteger(int)

b) toBinaryValue(int)

c) toBinaryNumber(int)

d) toBinaryString(int)

#### 9. What is the time complexity for converting decimal to binary numbers?

a) O(1)

b) O(n)

c) O(logn)

d) O(nlogn)

Decimal to Binary Using Stacks Question with FREE PDF

a) a*b(c+d)

b) abc*+de-+

c) +ab

d) a+b-c

a) True

b) False

a) O (N)

b) O (N log N)

c) O (N2)

d) O (M log N)

a) True

b) False

#### 14. Which of these operators have the highest order of precedence?

a) ‘(‘ and ‘)’

b) ‘*’ and ‘/’

c) ‘~’ and ‘^’

d) ‘+’ and ‘-‘

Answer: ‘~’ and ‘^’

#### 15. Which of the following is not an application of stack?

a) evaluation of postfix expression

b) conversion of infix to postfix expression

c) balancing symbols

d) line at ticket counter

Answer: line at ticket counter

#### 16. While evaluating a postfix expression, when an operator is encountered, what is the correct operation to be performed?

a) push it directly on to the stack

b) pop 2 operands, evaluate them and push the result on to the stack

c) pop the entire stack

d) ignore the operator

Answer: pop 2 operands, evaluate them and push the result on to the stack

#### 17. Which of the following statement is incorrect?

a) Postfix operators use value to their right

b) Postfix operators use value to their left

c) Prefix operators use value to their right

d) In postfix expression, operands are followed by operators

Answer: Postfix operators use value to their right

#### 18. What is the result of the given postfix expression? abc*+ where a=1, b=2, c=3.

a) 4

b) 5

c) 6

d) 7

Evaluation of a Postfix Expression Question with FREE PDF

#### 19. While evaluating a prefix expression, the string is read from?

a) left to right

b) right to left

c) center to right

d) center to left to right

Answer: right to left

a) True

b) False

a) one

b) two

c) three

d) four

#### 22. What determines the order of evaluation of a prefix expression?

a) precedence and associativity

b) precedence only

c) associativity only

d) depends on the parser

Answer: precedence and associativity

#### 23. Find the output of the following prefix expression.

*+2-2 1/-4 2+-5 3 1

a) 2

b) 12

c) 10

d) 4

a) true

b) false

a) 10

b) 4

c) 17

d) 14

#### 26. If -*+abcd = 11, find a, b, c, d using evaluation of prefix algorithm.

a) a=2, b=3, c=5, d=4

b) a=1, b=2, c=5, d=4

c) a=5, b=4, c=7,d=5

d) a=1, b=2, c=3, d=4

Answer: a=1, b=2, c=5, d=4

Evaluation of a Prefix Expression Question with FREE PDF

#### 27. Which of the following statement is incorrect with respect to evaluation of infix expression algorithm?

a) Operand is pushed on to the stack

b) If the precedence of operator is higher, pop two operands and evaluate

c) If the precedence of operator is lower, pop two operands and evaluate

d) The result is pushed on to the operand stack

Answer: If the precedence of operator is higher, pop two operands and evaluate

a) 3

b) 6

c) 5

d) 4

a) True

b) False

a) ^

b) +

c) /

d) #

a) True

b) False

#### 32. Evaluate the following and choose the correct answer.

a/b+c*d where a=4, b=2, c=2, d=1.

a) 1

b) 4

c) 5

d) 2

#### 33. Evaluate the following statement using infix evaluation algorithm and choose the correct answer.

4*2+3-5/5

a) 10

b) 11

c) 16

d) 12

50+ Evaluation of an Infix Expression (Not Parenthesized) MCQs with FREE PDF

a) (a+b)*(c+d)

b) ab+c*

c) +ab

d) abc+*

a) O(N log N)

b) O(N)

c) O(N2)

d) O(M log N)

a+b*c+(d*e)

a) abc*+de*+

b) abc+*de*+

c) a+bc*de+*

d) abc*+(de)*+

a) ab*cd*+

b) ab*cd-+

c) abcd-*+

d) ab*+cd-

#### 38. In infix to postfix conversion algorithm, the operators are associated from?

a) right to left

b) left to right

c) centre to left

d) centre to right

Answer: left to right

50+ Infix to Postfix Conversion MCQs with FREE PDF

A+(B*C)

a) +A*CB

b) *B+AC

c) +A*BC

d) *A+CB

(A*B)+(C*D)

a) +*AB*CD

b) *+AB*CD

c) **AB+CD

d) +*BA*CD

A+B*C^D

a) +A*B^CD

b) +A^B*CD

c) *A+B^CD

d) ^A*B+CD

a) +

b) \$

c) ^

d) &

a) +

b) \$

c) |

d) &

A^B^C^D

a) ^^^ABCD

b) ^A^B^CD

c) ABCD^^^

d) AB^C^D

a+b-c/d&e|f

a) |&-+ab/cdef

b) &|-+ab/cdef

c) |&-ab+/cdef

d) |&-+/abcdef

#### 46. What would be the Prefix notation for the given equation?

(a+(b/c)*(d^e)-f)

a) -+a*/^bcdef

b) -+a*/bc^def

c) -+a*b/c^def

d) -a+*/bc^def

50+ Infix to Prefix Conversion MCQs with FREE PDF

a) 19

b) 21

c) -4

d) 25

a) (A+B)*(C-D)

b) +AB*-CD

c) A+*BCD-

d) *+AB-CD

#### 49. Consider the postfix expression 4 5 6 a b 7 8 a c, where a, b, c are operators. Operator a has higher precedence over operators b and c. Operators b and c are right associative. Then, equivalent infix expression is

a) 4 a 5 6 b 7 8 a c

b) 4 a 5 c 6 b 7 a 8

c) 4 b 5 a 6 c 7 a 8

d) 4 a 5 b 6 c 7 a 8

Answer: 4 b 5 a 6 c 7 a 8

a) True

b) False

#### 51. Which of the following is valid reverse polish expression?

a) a op b

b) op a b

c) a b op

d) both op a b and a b op

Answer: a b op

#### 52. The result of the postfix expression 5 3 * 9 + 6 / 8 4 / + is _____________

a) 8

b) 6

c) 10

d) 9

50+ Postfix to Infix Conversion MCQs with FREE PDF

+ 9 * 3 / 8 4

a) 14

b) 15

c) 18

d) 12

#### 54. What would be the solution to the given prefix notation?

– + 1 2 * 3 / 6 2

a) 6

b) -6

c) 3

d) -3

#### 55. What would be the solution to the given prefix notation?

– * 1 5 / * / 6 3 6 2

a) 1

b) 0

c) -1

d) -2

#### 56. What would be the solution to the given prefix notation?

* / + 1 2 / 4 2 + 3 5

a) 12

b) 7.5

c) 9

d) 13.5

#### 57. Given a prefix and a postfix notation what are the difference between them?

a) The postfix equation is solved starting from the left whereas the prefix notation is solved from the right

b) The postfix equation is solved starting from the right whereas the prefix notation is solved from the left

c) Both equations are solved starting from the same side(right)

d) Both equations are solved starting from the same side(left)

Answer: The postfix equation is solved starting from the left whereas the prefix notation is solved from the right

50+ Prefix to Infix Conversion MCQs with FREE PDF

a) O (N log N)

b) O (N2)

c) O (N)

d) O (M log N)

a) bbabbca

b) abbcabb

c) bbacbba

d) bbacabb

#### 60. How many stacks are required for reversing a word algorithm?

a) one

b) two

c) three

d) four

50+ Reverse a Word using Stack MCQs with FREE PDF

#### 61. The optimal data structure used to solve Tower of Hanoi is _________

a) Tree

b) Heap

c) Priority queue

d) Stack

c) Malayalam

#### 63. Which data structure can be used to test a palindrome?

a) Tree

b) Heap

c) Stack

d) Priority queue