Grade 4 · Computer science
Grade 4 Algorithms & logic worksheet
20 questions on algorithms & logic. The answer key is a separate download.
What is on the worksheet
Rule: IF the number is greater than 5, THEN say “yes”, ELSE say “no”. The number is 1. What does the program say?
- no
- yes
A robot is on square D3 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?
- B2
- B3
- C2
- A2
Rule: IF the number is less than 11, THEN say “big”, ELSE say “small”. The number is 7. What does the program say?
- small
- big
Rule: IF the number is less than 10, THEN say “yes”, ELSE say “no”. The number is 8. What does the program say?
- yes
- no
A robot is on square B4 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?
- C4
- D5
- B5
- C5
A robot runs: repeat 3 times [move forward 3 steps]. How many steps does it move in total?
A dance program says: repeat 4 times [clap, clap, stomp]. How many claps are there in total?
A robot is on square C3 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?
- A3
- B3
- A4
- A2
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
Write an algorithm for arranging three books from shortest to tallest.
A robot is on square A2 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?
- D2
- C2
- E2
- D3
Rule: IF the number is greater than 9, THEN say “star”, ELSE say “moon”. The number is 6. What does the program say?
- moon
- star
Rule: IF the number is equal to 8, THEN say “yes”, ELSE say “no”. The number is 8. What does the program say?
- yes
- no
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?
- C4
- B5
- A4
- B4
A robot is on square B4 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
- E4
- E5
- E3
Rule: IF the number is less than 17, THEN say “yes”, ELSE say “no”. The number is 16. What does the program say?
- no
- yes
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
- D5
- E5
- C5
Rule: IF the number is equal to 8, THEN say “star”, ELSE say “moon”. The number is 7. What does the program say?
- moon
- star
Rule: IF the number is less than 19, THEN say “yes”, ELSE say “no”. The number is 18. What does the program say?
- no
- yes
A robot is on square E1 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?
- E1
- E3
- D2
- E2
Teach or revise the skill first
These short guides explain the idea with worked examples. Read one together before the worksheet, then use the sheet as practice.
- Algorithms without a computer: Study guide for Grades 3 to 6: make steps precise and trace before changing; 2 worked examples and 4 practice questions. An algorithm is a clear sequence of instructions for a task.
- Robot moves on a grid: Study guide for Grades 2 to 4: 2 worked examples and 2 practice questions. Trace the path one arrow at a time. Columns change with ← and →; rows change with ↑ and ↓.
- Repeat loops: Study guide for Grades 2 to 4: 2 worked examples and 2 practice questions. A loop repeats the same instructions. Multiply what happens inside the loop by the number of repeats.
More worksheets like this
Kindergarten Computer science practice
12 questions
Kindergarten Algorithms & logic worksheet
12 questions
Kindergarten Patterns worksheet
12 questions
Grade 1 Computer science practice
12 questions
Grade 1 Algorithms & logic worksheet
12 questions
Grade 1 Patterns (Computer science) worksheet
12 questions