To evaluate an expression without any embedded function calls :

2002

To evaluate an expression without any embedded function calls :

  1. A.

    As many stacks as the height of the expression tree are needed

  2. B.

    One stack is enough

  3. C.

    Two stacks are needed

  4. D.

    A Turing machine is needed in the general case

Attempted by 105 students.

Show answer & explanation

Correct answer: B

Without embedded function calls, expression evaluation does not need activation records for nested calls. A single stack can store operands and intermediate results while the expression is evaluated, for example in postfix evaluation. Hence one stack is enough.

Explore the full course: Gate Guidance By Sanchit Sir