Skip to main content

Subsection 2.3.5 Problems That Explore Operator Precedence

Exercises Exercises

Exercise Group.

1.

Suppose that you type the following arithmetic expression into Excel or a simple calculator app such as this one.

\(3*12+8/4 \)

(Part 1) What answer will you get:

  1. 15

  2. 42

  3. 38

  4. 11

Answer.
Correct answer is C
Solution.
2.

(Part 2) In what order were the operators performed to get that answer?

  1. Multiply 3*12, then add 8, then divide by 4.

  2. Add 12 and 8, then multiply by 3, then divide by 4.

  3. Divide 8 by 4, add that to 12, then multiply by 3.

  4. Multiply 3 by 12. Divide 8 by 4. Add those two numbers

Answer.
Correct answer is D.
Solution.
Explanation: All multiplications and divisions are done before any additions or subtractions.

Exercise Group.

2.

Suppose that you type the following arithmetic expression into Excel or a simple calculator app such as this one:

12 + 16 * 2 + 1

(Part 1) What answer will you get:

  1. 57

  2. 45

  3. 51

  4. 84

Answer.
Correct answer is B.
b.

(Part 2) In what order were the operators performed to get that answer?

  1. Multiply 16*2, then add that to 12. Finally, add 1.

  2. Add 12 and 16, then multiply by 2, then add 1.

  3. Add 2 and 1. Multiply 16 by that, then add to 12.

  4. Multiply 3 by 12. Divide 8 by 4. Add those two numbers.

Answer.
Correct answer is A.
Solution.
Explanation: All multiplications are done before any additions.