Find the output of the following prefix expression.
*+2-2 1/-4 2+-5 3 1
a) 2
b) 12
c) 10
d) 4
Answer: a
Explanation: The given prefix expression is evaluated using two stacks and the value is given by (2+2-1)*(4-2)/(5-3+1)= 2.
Related Posts
Which one of the following operations returns the first occurrence of bit 1 in bit arrays?
Bit fields and Bit arrays are same.
What does Hamming weight/population count mean in Bit arrays?
Run-Length encoding is used to compress data in bit arrays.
Which of the following bitwise operator will you use to invert all the bits in a bit array?
Which class in Java can be used to represent bit array?
Which of the following is/are not applications of bit arrays?
Join The Discussion