Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)

YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

CLICK HERE TO DOWNLOAD

Data Structure Questions and Answers-Evaluation of an Infix Expression (Not Parenthesized)

Question 6 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Evaluation of infix expression is done based on precedence of operators.
A
True
B
False
Question 6 Explanation: 
During evaluation of infix expression, the operators with higher precedence are evaluated first, followed by operators with lower precedence.

Question 7 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Of the following choice s, which operator has the lowest precedence?
A
^
B
+
C
/
D
#
Question 7 Explanation: 
The operator with the lowest precedence is #, preceded by +, / and then ^.

Question 8 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The system throws an error if parentheses are encountered in an infix expression evaluation algorithm.
A
True
B
False
Question 8 Explanation: 
The algorithm holds good for infix expression with parentheses. The system does not throw error.

Question 9 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Evaluate the following and choose the correct answer.

a/b+c*d where a=4, b=2, c=2, d=1.

A
1
B
4
C
5
D
2
Question 9 Explanation: 
* and / have higher priority. Hence, they are evaluated first. Then, + is evaluated. Hence, 2+2=4.

Question 10 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Evaluate the following statement using infix evaluation algorithm and choose the correct answer. 4*2+3-5/5
A
10
B
11
C
16
D
12
Question 10 Explanation: 
4*2 and 5/5 are evaluated first and then, 8+3-1 is evaluated and the result is obtained as 10.

There are 10 questions to complete.