+1 vote
in Data Structures & Algorithms I by (110k points)
Using the evaluation of infix expression, evaluate a^b+c  and choose the correct answer. (a=2, b=2, c=2)

(a) 12

(b) 8

(c) 10

(d) 6

This question is from Evaluation of an Infix Expression (Not Parenthesized) in division Application of Stacks of Data Structures & Algorithms I

This question was addressed to me by my college director while I was bunking the class.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
Correct answer is (d) 6

Easy explanation - ^ has the highest precedence. Hence, 2^2 is evaluated and then 4+2 gives 6.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.