Stacks

Question 1

Which of the following is essential for converting an infix expression to the postfix from efficiently?

A
An operator stack
B
An operand stack
C
An operand stack and an operator stack
D
A parse tree
       Data-Structures       Stacks       GATE 1997
Question 1 Explanation: 
An operator stack ⇒ Infix to (Postfix or Prefix)
An operand stack ⇒ Postfix to Prefix
Operator & operand stack ⇒ We don't use two stacks
Parse tree ⇒ No use
Question 2

To evaluate an expression without any embedded function calls

A
One stack is enough
B
Two stacks are needed
C
As many stacks as the height of the expression tree are needed
D
A Turning machine is needed in the general case
       Data-Structures       Stacks       GATE 2002
Question 2 Explanation: 
To evaluate an expression or converting prefix to postfix, postfix to prefix only one stack is enough.
There are 2 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access