Evaluation of a Prefix Expression Multiple choice Questions and Answers (MCQs)
How many stacks are required for evaluation of prefix expression?
Question 1 Explanation:
2 stacks are required for evaluation of postfix expression, one for integers and one for characters.
While evaluating a prefix expression, the string is read from?
left to right
right to left
center to right
center to left to right
Question 2 Explanation:
The string is read from right to left because a prefix string has operands to its right side.
The associativity of an exponentiation operator ^ is right side.
Question 3 Explanation:
The associativity of ^ is right side while the rest of the operators like +, -, *, / has its associativity to its left.
How many types of input characters are accepted by this algorithm?
Question 4 Explanation:
Three kinds of input are accepted by this algorithm- numbers, operators and new line characters.
What determines the order of evaluation of a prefix expression?
precedence and associativity
depends on the parser
Question 5 Explanation:
Precedence is a very important factor in determining the order of evaluation. If two operators have the same precedence, associativity comes into action.
There are 5 questions to complete.