Infix To Postfix MCQ
Infix To Postfix MCQ
Question 2. The data structure required to check whether an expression contains balanced
parenthesis is?
a) Stack
b) Queue
c) Array
d) Tree
ANSWER: a) Stack
Question 3. What data structure would you mostly likely see in a non recursive implementation of
a recursive algorithm?
a) LinkList
b) Stack
c) Queue
d) Tree
ANSWER: b) Stack
Question 4. The process of accessing data stored in a serial access memory is similar to
manipulating data on a ------?
a) Heap
b) Binary Tree
c) Array
d) Stack
ANSWER: d) Stack
Question 6. Which data structure is needed to convert infix notation to postfix notation?
a) Branch
b) Tree
c) Queue
d) Stack
ANSWER: d) Stack
a) + pq - *rt
b) - +pqr * t
c) - +pq * rt
d) - + * pqrt
ANSWER: c) - +pq * rt
Question 12. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E - F)+G
a) (A B D ⋀ + E F - / G +)
b) (A B D +⋀ E F - / G +)
c) (A B D ⋀ + E F/- G +)
d) None
ANSWER: a) (A B D ⋀ + E F - / G +)
Question 13. Convert the following Infix expression to Postfix form using a stack
x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.
a) xyz*+pq*r+s*+
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+
d) none
ANSWER: a) xyz*+pq*r+s*+
Question 14. Which of the following statement(s) about stack data structure is/are NOT correct?
a) Stack data structure can be implemented using linked list
b) New node can only be added at the top of the stack
c) Stack is the FIFO data structure
d) The last node at the bottom of the stack has a NULL link
ANSWER: c) Stack is the FIFO data structure
Question 15. Consider the linked list implementation of a stack. Which of the following node is
considered as Top of the stack?
a) First node
b) Last node
c) Any node
d) Middle node
ANSWER: a) First node
Question 18. Which of the following operation take worst case linear time in the array
implementation of stack?
a) Push
b) Pop
c) IsEmpty
d) None
ANSWER: d) None
Question 19. The type of expression in which operator succeeds its operands is?
a) Infix Expression
b) pre fix Expression
c) postfix Expression
d) None
ANSWER: c) postfix Expression
Question 22. What is the minimum number of stacks of size n required to implement a queue of
size n?
a) One
b) Two
c) Three
d) Four
ANSWER: b) Two
Question 23. Assume that the operators +,-, X are left associative and ⋀ is right associative. The
order of precedence (from highest to lowest) is ⋀, X, +, -. The postfix expression corresponding to
the infix expression a + b X c – d ⋀ e ⋀ f is
a) abc X+ def ⋀ ⋀ -
b) abc X+ de⋀f⋀ -
c) ab+c Xd – e ⋀f⋀
d) -+aXbc⋀ ⋀def
ANSWER: a) abc X+ def ⋀ ⋀ -
Question 24. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a
time, in what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABDC
ANSWER: b) DCBA
Question 25. Consider the usual implementation of parentheses balancing program using stack.
What is the maximum number of parentheses that will appear on stack at any instance of time
during the analysis of ( ( ) ( ( ) ) ( ( ) ) )?
a) 1
b) 2
c) 3
d) 4
ANSWER: c) 3
Answer: b
Explanation: None.
2. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E – F)+G
a) (A B D ⋀ + E F – / G +)
b) (A B D +⋀ E F – / G +)
c) (A B D ⋀ + E F/- G +)
d) None of the mentioned
View Answer
Answer: a
Explanation: Applying the postfix expression evaluation.
Answer: a
Explanation: Applying the postfix expression evaluation.
8. Assume that the operators +,-, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix
expression a + b X c – d ^ e ^ f is
a) abc X+ def ^^ –
b) abc X+ de^f^ –
c) ab+c Xd – e ^f^
d) -+aXbc^ ^def
View Answer
Answer: a
Explanation: Applying the postfix expression evaluation.
Answer: d
Explanation: On solving the postfix expression the answer comes out to 18.
10.Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to
convert the expression from infix to postfix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion
of this expression?
a) 1
b) 2
c) 3
d) 4
Answer: d
Answer: a
a) *AB/CD+
b) AB*CD/+
c) A*BC+/D
d) ABCD+/*
Answer: b
Answer: c
a) 600
b) 350
c) 650
d) 588
Answer: b
22. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E – F)+G
a) (A B D ⋀ + E F – / G +)
b) (A B D +⋀ E F – / G +)
c) (A B D ⋀ + E F/- G +)
d) None of the mentioned
Answer: a
23. Convert the following Infix expression to Postfix form using a stack
x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.
a) xyz*+pq*r+s*+
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+
d) None of the mentioned
Answer: a
28. Assume that the operators +,-, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix
expression a + b X c – d ^ e ^ f is
a) abc X+ def ^^ –
b) abc X+ de^f^ –
c) ab+c Xd – e ^f^
d) -+aXbc^ ^def
Answer: a