Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Given an expression

$(A+B*D)/(E-F)+G$

  1. The prefix notation is $+/+A*DB-EFG$
  2. The prefix expression is the reverse of the postfix expression
  3. The order of operands in infix expression and postfix expression are the same.
  4. 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:






Solution

Given expression is:

$(A+B*D)/(E-F)+G$

First solve according to operator precedence:

$B*D$

So, expression becomes:

$(A+(B*D))/(E-F)+G$

Prefix of $B*D$ is:

$*BD$

Prefix of $A+B*D$ is:

$+A*BD$

Prefix of $E-F$ is:

$-EF$

Now prefix of $\frac{A+B*D}{E-F}$ is:

$/+A*BD-EF$

Finally add $G$:

$+/+A*BD-EFG$

So, statement $1$ is true.

Prefix is not simply the reverse of postfix.

So, statement $2$ is false.

The order of operands in infix and postfix remains:

$A,B,D,E,F,G$

So, statement $3$ is true.

The order of operands in infix, prefix, and postfix also remains the same:

$A,B,D,E,F,G$

So, statement $4$ is true.

Correct statements are:

$1,3,$ and $4$



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...