Arithmetic in Code: Integer Division and Remainder · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

Divide, leave over, order up

Computing · Programming · ages 14-15
Name ______________________   Date ____________
  1. What does this expression evaluate to: 2 * (3 + 4)

    Answer: ______________

  2. // keeps only the remainder of a division.

    Circle one:   True   False

  3. That same stopwatch shows 125 seconds. After you take out the full minutes, how many seconds are left over? (Hint: find 125 % 60.)

    Answer: ______________

  4. True or false: in the expression 2 * 3 + 4, the multiplication runs before the addition.

    Circle one:   True   False

  5. A timer holds 200 seconds. How many leftover seconds does 200 % 60 give?

    Answer: ______________

  6. What is the value of 2 * (3 + 4)?

    • 10
    • 11
    • 14
  7. A song lasts 197 seconds. How many seconds are left over after counting out full minutes? (Hint: find 197 % 60.)

    Answer: ______________

  8. You have 53 stickers to hand out in packs of 6. Using integer division, how many full packs of 6 can you make? (Hint: find 53 // 6.)

    Answer: ______________

  9. A cutscene lasts 137 seconds. How many whole minutes does 137 // 60 give?

    Answer: ______________

  10. What is the value of (5 + 3) * 2 - 4?

    • 8
    • 12
    • 16
LightMySky · lightmysky.comW1-mt_ZPnPrLGPmT-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Divide, leave over, order up W1-mt_ZPnPrLGPmT-s1

  1. 14 · Parentheses run before multiplication, so the addition inside happens first.
  2. False · // keeps the whole part. % is the one that keeps the remainder.
  3. 5 · The remainder operator gives you exactly what's left after dividing out the full minutes.
  4. True · Multiplication outranks addition, so 2 * 3 is computed before 4 is added.
  5. 20 · Three 60s make 180, and 200 minus 180 leaves 20.
  6. 14 · Brackets run first, so 3 + 4 happens before the multiply.
  7. 17 · The remainder is whatever is left once you've pulled out all the complete 60-second minutes.
  8. 8 · Integer division tells you the whole number of packs, ignoring any leftover stickers.
  9. 2 · Two 60s make 120, and a third would need 180.
  10. 12 · Brackets first, then multiply, then subtract.
Worksheet · LightMySky