Computer science · Grades K–4
Algorithms & logic · Quick reference 1
Reference sheet for Kindergarten to Grade 4: 5 key ideas, including robot on a number path, put the steps in order and robot moves on a grid. Follow the steps one at a time, in order, and keep track of where the robot is after each step.
Rule and key idea
Robot on a number path
Follow the steps one at a time, in order, and keep track of where the robot is after each step.
→ = 1 forward · ← = 1 back
A robot is on square 3. → means move 1 forward. ← means move 1 back. Steps: ← ← ←. Which square does the robot stop on? → 0
Put the steps in order
An algorithm is a list of steps in the right order. Ask: what has to happen before this step can work?
algorithm = steps in the right order
To wash your hands, which step comes first: “turn on the tap” or “rub your hands with soap”? → turn on the tap
Robot moves on a grid
Trace the path one arrow at a time. Columns change with ← and →; rows change with ↑ and ↓.
↑ row + 1 · ↓ row − 1 · → next column · ← previous column
A robot is on square D2 of a grid. Columns A to E go from left to right; rows 1 to 5 go from bottom to top. Each arrow moves it one square: ← ↓. Which square does it end on? → C1
Repeat loops
A loop repeats the same instructions. Multiply what happens inside the loop by the number of repeats.
repeat n times [k steps] → n × k steps
A robot runs: repeat 3 times [move forward 2 steps]. How many steps does it move in total? → 6
Find the bug
Debugging means checking each step against the plan to find the one that is wrong.
bug = a step that does not match the plan
A robot must move 4 squares to the right to reach a star, so every step should be →. Its program is: ↓ → → →. Which step number is the bug? → 1
Check yourself
Four practice questions on this topic. Try each one before you open the answer.
A robot is on square C2 of a grid. Columns A to E go from left to right; rows 1 to 5 go from bottom to top. Each arrow moves it one square: → ← → →. Which square does it end on?
- E3
- E2
- D2
- E1
Show the answer
E2 Start at C2, follow → ← → →, end at E2.
A robot is on square D5 of a grid. Columns A to E go from left to right; rows 1 to 5 go from bottom to top. Each arrow moves it one square: ↓ →. Which square does it end on?
- E4
- E3
- E5
- D4
Show the answer
E4 Start at D5, follow ↓ →, end at E4.
A robot is on square C4 of a grid. Columns A to E go from left to right; rows 1 to 5 go from bottom to top. Each arrow moves it one square: → →. Which square does it end on?
- D4
- E5
- E4
- E3
Show the answer
E4 Start at C4, follow → →, end at E4.
A robot is on square E4 of a grid. Columns A to E go from left to right; rows 1 to 5 go from bottom to top. Each arrow moves it one square: ↑ ↓ ↑. Which square does it end on?
- E5
- D5
- E4
- D4
Show the answer
E5 Start at E4, follow ↑ ↓ ↑, end at E5.
How this page was made: written for StudyBrix with AI assistance from our own templates. Answers and worked examples are checked by automated tests, and grade bands are approximate, not an official curriculum alignment. See the editorial policy for corrections. Editorial policy