Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following applications may use a stack ?

  • A.A parentheses balancing program
  • B.Tracking of local variables at run time
  • C.Compiler syntax analyzer
  • D.All of the mentioned

Answer: D

The answer is All of the mentioned.

A parentheses-balancing program pushes each opening bracket and pops on each closing one; the expression is balanced if every pop matches and the stack ends empty. At run time, local variables live in activation records on the call stack, pushed on a function call and popped on return. A compiler's syntax analyser, such as an LR or LL parser, keeps grammar symbols and states on a parsing stack.

Since each of the three uses a stack, choosing any one alone would be incomplete.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.