retagged by
2,065 views
5 votes
5 votes

______ to evaluate an expression without any embedded function calls.

  1. Two stacks are required
  2. one stack is needed
  3. Three stacks are required
  4. More than three stacks are required
retagged by

5 Answers

2 votes
2 votes
Applications of stack are
Converting infix expression into post/prefix expression
Evaluating post/pre-fix expression
Parenthesis matching
With one stack also we can easily evaluate the expression.

Answer-B.One stack is needed
1 votes
1 votes
One stack is sufficient to evaluate an expression that doesn't have any embedded function calls.
1 votes
1 votes

The rule is that each function call results in a creation of a stack frame.

When a function call is made, function's arguments are PUSHed on stack. These arguments are further referenced by base pointer.

When the function returns to its caller, the arguments of the returning function are POPed from the stack using LIFO method.

Since there is no function call is embedded, the expression can be evaluated by using only one stack.

Answer:

Related questions

1 votes
1 votes
3 answers
1
Arjun asked Dec 7, 2018
1,470 views
Evaluation of the given postfix expression $10 \: 10 + 60 \: 6/^*8-$ is$192$$190$$110$$92$
2 votes
2 votes
1 answer
2
shekhar chauhan asked Jul 14, 2016
1,684 views
If we have to construct the expression tree from this expression (3 + ((5+9)*2)) then what will be the order of push and pop operation on a stack ?Explain what to do with...
1 votes
1 votes
0 answers
3
iarnav asked Nov 19, 2017
632 views
To evaluate an expression with any embedded function call at any time how many stacks are needed?
1 votes
1 votes
3 answers
4
Arjun asked Dec 7, 2018
1,257 views
The smallest element that can be found in time ____ in a binary max heap.$O(n \log n)$$O( \log n)$$O(n)$$O(n^2)$