Grade 4 · unit review

Review: Trace and Repair Changing Values

Track counters, assignment order and accumulated totals, then repair misplaced resets.

Bring the unit skills together

Use these 4 new cases to check your reasoning. Choices are temporary and are not saved to an account, sent to staff or recorded as school grades. Download your current review choices before leaving or reloading.

Unit review questions
1. Set count = 2. Repeat three times: add 3. What is shown?
2. Start a = 7, b = 0; b = a; a = a + 2. What is b at the end?
3. Set total = 0; add every item in [4, 2, 3]. What is the final total?
4. A draft resets total = 0 inside each visit to [2, 7, 1]. Which change makes it sum all items?

The download contains your current choices and any checked feedback. Keep the separate transfer-task work in your own document; downloading its instructions does not mark it complete.

Use the skills in a new task

Build a paper program for [1, 4, 2]: start total at 0, add every item, copy the completed total into saved, then add 3 to total. Show both variables. Explain and repair a draft that resets total before each item.

Work on paper or in your own document. Explain the choices you made.

  • Trace accumulated totals 1, 5, 7.
  • Initialize before the loop and identify why an inside reset gives only 2.
  • Copy saved = 7 before changing total.
  • Show final total = 10 and saved = 7.
Compare with a model response

Set total = 0; for each item, total = total + item. Trace: 0 → 1 → 5 → 7. Set saved = total, so saved = 7; then total = total + 3, so total = 10. Show (10, 7). The reset-inside draft shows 2; moving that reset before the loop repairs accumulation.

A different response can also meet the criteria. Compare the evidence and reasoning, rather than copying the wording.