
Which of the following is an example for a postfix expression?
A) $a*b(c + d)$
B) $abc* + de$
C) $ + ab$
D) $a + b - c$
Answer
465k+ views
Hint: An arithmetic expression can be written in three ways:
Infix: $a*b$ : where the operator is between the two operands.
Prefix: $*ab$ : where the operator is preceding the two operands.
Postfix: $ab*$ : where the operator is post or after the two operands.
These are Polish representations.
Using this knowledge, we examine every option and try to find out if it’s a postfix expression or not.
Complete step by step solution:
We know that there are three types of expressions: Infix, Prefix and Postfix.
Let’s start by examining every option.
Option A: $a*b(c + d)$
This operation is a normal infix expression as the operator is in between the two operands on which the operation has to be performed.
Option B: $abc* + de$
This expression is neither prefix nor postfix.
We need to remember that a postfix expression will always have an operator at the end because the operator comes after the operands and also that a prefix expression will always have an operator at the beginning because the operator comes before the operands.
This is not an infix expression as well because two operators never come consecutively in an infix expression.
Option C: $ + ab$
This is clearly a prefix expression since the $ + $ operator is between the two operands.
Option D: $a + b - c$
This is clearly an infix expression since the operators are between their corresponding operands.
None of the options are postfix.
Note: Having a good idea about the definitions of postfix, prefix and infix expressions will help to solve the question. These expressions are Polish representations which make the work easier when evaluating an expression since there is not requirement of priorities or precedence of the operators. The equation can simply be evaluated by going from either left to right or right to left.
Infix: $a*b$ : where the operator is between the two operands.
Prefix: $*ab$ : where the operator is preceding the two operands.
Postfix: $ab*$ : where the operator is post or after the two operands.
These are Polish representations.
Using this knowledge, we examine every option and try to find out if it’s a postfix expression or not.
Complete step by step solution:
We know that there are three types of expressions: Infix, Prefix and Postfix.
Let’s start by examining every option.
Option A: $a*b(c + d)$
This operation is a normal infix expression as the operator is in between the two operands on which the operation has to be performed.
Option B: $abc* + de$
This expression is neither prefix nor postfix.
We need to remember that a postfix expression will always have an operator at the end because the operator comes after the operands and also that a prefix expression will always have an operator at the beginning because the operator comes before the operands.
This is not an infix expression as well because two operators never come consecutively in an infix expression.
Option C: $ + ab$
This is clearly a prefix expression since the $ + $ operator is between the two operands.
Option D: $a + b - c$
This is clearly an infix expression since the operators are between their corresponding operands.
None of the options are postfix.
Note: Having a good idea about the definitions of postfix, prefix and infix expressions will help to solve the question. These expressions are Polish representations which make the work easier when evaluating an expression since there is not requirement of priorities or precedence of the operators. The equation can simply be evaluated by going from either left to right or right to left.
Recently Updated Pages
Master Class 8 Social Science: Engaging Questions & Answers for Success

Master Class 8 Maths: Engaging Questions & Answers for Success

Master Class 8 Science: Engaging Questions & Answers for Success

Class 8 Question and Answer - Your Ultimate Solutions Guide

Master Class 8 English: Engaging Questions & Answers for Success

Why are manures considered better than fertilizers class 11 biology CBSE

Trending doubts
What is BLO What is the full form of BLO class 8 social science CBSE

Citizens of India can vote at the age of A 18 years class 8 social science CBSE

Full form of STD, ISD and PCO

Right to vote is a AFundamental Right BFundamental class 8 social science CBSE

What is the difference between rai and mustard see class 8 biology CBSE

Summary of the poem Where the Mind is Without Fear class 8 english CBSE


