Q85.Marks: +2.0UGC NET Paper 2: Computer Science 11 March 2023
Given an expression
(A + B * D)/(E - F) + G
A. The prefix notation is +/+A*DB - EFG
B. The prefix expression is the reverse of the postfix expression
C. The order of operands in infix expression and postfix expression are the same.
D. The order of operands in infix expression, prefix expression and postfix expression are the same.
Choose the most appropriate answer from the options given below:
1.A, C and D Only
2.C and D Only ✓ Correct
3.A and B Only
4.A and D Only
Solution
The correct answer is C and D Only
Key PointsLet's analyze each option:
The prefix notation is +/+A*DB - EFG
This is incorrect. The correct prefix notation for the given expression (A + B * D)/(E - F) + G is: + / + A * B D - E F G
The prefix expression is the reverse of the postfix expression
The postfix expression for the given expression is: A B D * + E F - / G +
If we reverse this, we get: + G / - F E + * D B A
This is not the same as the correct prefix notation, so option B is not correct.
The order of operands in infix expression and postfix expression are the same.
This statement is true. In infix notation (the typical mathematical notation), the operands are placed between the operators. In postfix notation, the order of operands remains the same as in infix notation.
The order of operands in infix expression, prefix expression, and postfix expression are the same.
The order of operands in infix expression, prefix expression and postfix expression are the same" is true. Even though the arrangement of operators varies between these notation formats, the occurrence of operands remains the same.