MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

THEORY OF COMPUTATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the postfix equivalent of the following infix expression?5 + 6
A
+ 5 6
B
5 6 +
C
6 + 5
D
6 + 5 +
Explanation: 

Detailed explanation-1: -hHow do we convert it to postfix notation. For example, the infix expression (2+3)*(4+5) in postfix notation is 23+45+* and the infix expression 2+3*4+5 in postfix notation is 234*+5+. Also, since our four operators are left associative, 2 + 3 + 4 translates to 23+4+ and not 234++.

Detailed explanation-2: -1. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is? = 350. 2.

Detailed explanation-3: -Hence, value = (2 + 3) * (4 – (5 – 6)) = 5 *(4 – (-1)) = 5*5 = 25. Explanation: To convert from postfix to prefix, we first convert it to infix and then to prefix.

Detailed explanation-4: -1 Answer. The best explanation: Postfix Expression is (6*(3-(2+4))) which results-18 as output.

There is 1 question to complete.