(15 points) Assume the following rules of associativity and precedence for expre
ID: 3714524 • Letter: #
Question
(15 points) Assume the following rules of associativity and precedence for expressions Precedence Highest *, /, not , &, mod (unary) and or, xor Lowest Associativity Left to right Show the order of evaluation of the following expressions by parenthesizing all subexpressions and placing a superscript on the right parenthesis to indicate order. For example, for the expression a +b* c + d the order of evaluation would be represented as ((a+ (b c)12+ d) 3 b. a * (b-I) / c mod d c. (a -bc & (d e/ a - 3) d. -a or c-d and e e. a > b xor c or dExplanation / Answer
Order of evaluation with precedence and left to right associativity [The numbers immediately after the right parenthesis gives the order in which the expression is evaluated]
a. (((a * b)1 - 1)2 + c)3
b. (((a * (b-1)1)2 / c)3 mod d)4
c. (((a - b)1 / c)2 & (((d*e)3/a)4-3)5)6
d. ((-a)1 or ((c = d)2 and e)3 )4
e. (((a > b)1 xor c)3 or (d <= 17)2 )4
f. (-(a + b)1 )2
Order of evaluation without precedence and right to left associativity [The numbers immediately after the right parenthesis gives the order in which the expression is evaluated]
a. (a * (b - (1 + c)1 )2 )3
b. (a * ((b-1)2 / (c mod d)1 )3 )4
c. ((a - b)5 / (c & (d* (e/ ( a-3 )1 )2 )3 )4 )6
d. (-(a or (c = (d and e)1 )2 )3 )4
e. (a > (b xor (c or (d <= 17)1 )2 )3 )4
f. (-(a +b)1 )2
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.