StudyBrixFree worksheets, study guides and courses

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

  1. Rule: IF the number is greater than 5, THEN say “yes”, ELSE say “no”. The number is 1. What does the program say?

    1. no
    2. yes
  2. 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?

    1. B2
    2. B3
    3. C2
    4. A2
  3. Rule: IF the number is less than 11, THEN say “big”, ELSE say “small”. The number is 7. What does the program say?

    1. small
    2. big
  4. Rule: IF the number is less than 10, THEN say “yes”, ELSE say “no”. The number is 8. What does the program say?

    1. yes
    2. no
  5. 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?

    1. C4
    2. D5
    3. B5
    4. C5
  6. A robot runs: repeat 3 times [move forward 3 steps]. How many steps does it move in total?

  7. A dance program says: repeat 4 times [clap, clap, stomp]. How many claps are there in total?

  8. 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?

    1. A3
    2. B3
    3. A4
    4. A2
  9. 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?

    1. E5
    2. D5
    3. E4
    4. D4
  10. Write an algorithm for arranging three books from shortest to tallest.

  11. 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?

    1. D2
    2. C2
    3. E2
    4. D3
  12. Rule: IF the number is greater than 9, THEN say “star”, ELSE say “moon”. The number is 6. What does the program say?

    1. moon
    2. star
  13. Rule: IF the number is equal to 8, THEN say “yes”, ELSE say “no”. The number is 8. What does the program say?

    1. yes
    2. no
  14. 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?

    1. C4
    2. B5
    3. A4
    4. B4
  15. 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?

    1. D4
    2. E4
    3. E5
    4. E3
  16. Rule: IF the number is less than 17, THEN say “yes”, ELSE say “no”. The number is 16. What does the program say?

    1. no
    2. yes
  17. 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?

    1. D4
    2. D5
    3. E5
    4. C5
  18. Rule: IF the number is equal to 8, THEN say “star”, ELSE say “moon”. The number is 7. What does the program say?

    1. moon
    2. star
  19. Rule: IF the number is less than 19, THEN say “yes”, ELSE say “no”. The number is 18. What does the program say?

    1. no
    2. yes
  20. 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?

    1. E1
    2. E3
    3. D2
    4. 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