CTS
Company
undefined
Q. What is the postfix form of the following prefix expression -A/B*C$DE
(A) ABCDE$*/- (B) A-BCDE$*/-
(C) ABC$ED*/- (D) A-BCDE$*/
Read Solution (Total 9)
-
- correct answer is option A)
reason-->for prefix to postfix always scan from right to left.
if it is an operand ,push inside stack.
if it is an operator, pop out everything from the stack in the order of:
OPERAND1 OPERAND2 OPERATOR
now here in this eg,(scan from right to left)
1)the stack at first contains E,then D, then $ operator so pop out as DE$
2)now the stack contains DE$,C,*, now since the stack contains an operator *, so pop out as CDE$* bcoz operand1 is DES, operand2 is C and operator is *
3)now again after pushing B and / , the stack will bcum BCDE$*/
4)now again pushing A and - in to stack, since "-" is an operator so after popping out it bcums ABCDE$*/-
hence found)
do keep in mind to always scan from right to left
and while popping out, the format should be OPERAND1 OPERAND2 OPERATOR - 10 years agoHelpfull: Yes(19) No(0)
- May be option A
Since there is 5 alphabets $is a symbol
Infix expression can be given as -A/B*C$DE
From the infix expression,
Postfix expression is ABCDE$*/-
Correct if I m wrong - 10 years agoHelpfull: Yes(3) No(0)
- Plz always provide correct answer of each question. In the entire site no accurate answer is provided by d admin.its difficult to relie on others answer. Like toddays puzzle plz admin plz provide correct answer of each question on dis site
- 10 years agoHelpfull: Yes(2) No(0)
- Plz always provide correct answer of each question. In the entire site no accurate answer is provided by d admin.its difficult to relie on others answer. Like toddays puzzle plz admin plz provide correct answer of each question on dis site
- 10 years agoHelpfull: Yes(1) No(0)
- May be Ans is C.
- 10 years agoHelpfull: Yes(0) No(1)
- may be D
- 10 years agoHelpfull: Yes(0) No(0)
- According to me ans is : D
- 10 years agoHelpfull: Yes(0) No(0)
- Ans is option a
We have to convert it into Postfix notation so start scanning from Left to right. - 10 years agoHelpfull: Yes(0) No(0)
- First of all convert it into infix form.
Then push the variables into the stack whenever come across operator manipulate it between stack top two elements................ - 10 years agoHelpfull: Yes(0) No(0)
CTS Other Question