 # KS1 Computing Quiz - Code - How to Write Code 1 (Questions)

This quiz addresses part of the requirements of the National Curriculum KS1 for children aged 5 and 6 in years 1 and 2 in Computing. Specifically it looks at how to write a simple code to draw shapes on a computer screen. It is one of 20 quizzes to help you find out about how computers work, and how they affect all our lives.

Ella is using a computer to draw shapes. A hedgehog on the computer screen walks round the different shapes. Ella is writing code to get the hedgehog to draw the correct shape on the computer screen. In this quiz, Ella is programming the hedgehog to draw a rectangle. The rectangle must be 30cm long and 20cm deep.

1. The hedgehog starts in the top left-hand corner of the screen. The hedgehog is ready to go. Remember, the rectangle must be 30cm long. What is Ella’s first line of code?
 [ ] Forward 20cm [ ] Forward 30cm [ ] Forward 50cm [ ] Stop
2. The hedgehog is in the top-right corner. Ella wants to make the hedgehog turn the corner so it is ready to walk down the screen. What does Ella code?
 [ ] Turn right [ ] Turn left [ ] Go back 30cm [ ] Go back 50cm
3. The rectangle must be 20cm deep. What does Ella code next?
 [ ] Forward 10cm [ ] Forward 20cm [ ] Forward 30cm [ ] Forward 50cm
4. The hedgehog is now in the bottom right of the screen. Ella needs to turn the hedgehog so it is facing left, along the bottom of the screen. What code does Ella write?
 [ ] Turn right [ ] Stop [ ] Go [ ] Turn left
5. Ella now writes the code: Forward 30cm.

What does the hedgehog do?
 [ ] Moves 30cm backwards [ ] Moves 20cm forwards [ ] Moves 30cm forwards [ ] Moves 50cm forwards
6. The hedgehog is now in the bottom left-hand corner of the screen.

How many sides of the rectangle has the hedgehog drawn so far?
 [ ] 1 [ ] 2 [ ] 3 [ ] 4
7. The hedgehog is still in the bottom left-hand corner of the screen. The hedgehog is still facing to the left. Ella wants to make the hedgehog face upwards. What should Ella code?
 [ ] Turn right [ ] Turn left [ ] Turn round [ ] Turn back
8. Ella makes the hedgehog finish the rectangle. The rectangle is 20cm deep. What is her last line of code?
 [ ] Forward 30cm [ ] Stop [ ] Back 20cm [ ] Forward 20cm
9. The hedgehog has now drawn a complete rectangle. How many sides has it drawn?
 [ ] 1 [ ] 2 [ ] 3 [ ] 4
10. Ella has drawn a rectangle 30cm by 20cm. Her teacher now asks Ella to draw a rectangle 15cm by 10cm using the hedgehog.

Ella’s first line of code was: Forward 30cm.

What is Ella’s new first line of code?
 [ ] Back 15cm [ ] Back 30cm [ ] Forward 15cm [ ] Forward 20cm KS1 Computing Quiz - Code - How to Write Code 1 (Answers)
1. The hedgehog starts in the top left-hand corner of the screen. The hedgehog is ready to go. Remember, the rectangle must be 30cm long. What is Ella’s first line of code?
 [ ] Forward 20cm [x] Forward 30cm [ ] Forward 50cm [ ] Stop
The hedgehog walks 30cm right across the top of the screen
2. The hedgehog is in the top-right corner. Ella wants to make the hedgehog turn the corner so it is ready to walk down the screen. What does Ella code?
 [x] Turn right [ ] Turn left [ ] Go back 30cm [ ] Go back 50cm
The hedgehog turns right, ready to go down the screen
3. The rectangle must be 20cm deep. What does Ella code next?
 [ ] Forward 10cm [x] Forward 20cm [ ] Forward 30cm [ ] Forward 50cm
The hedgehog moves down the screen 20cm. Ella has drawn two sides of the rectangle
4. The hedgehog is now in the bottom right of the screen. Ella needs to turn the hedgehog so it is facing left, along the bottom of the screen. What code does Ella write?
 [x] Turn right [ ] Stop [ ] Go [ ] Turn left
Tricky! If the hedgehog turns left, it will go off the screen in the wrong direction!
5. Ella now writes the code: Forward 30cm.

What does the hedgehog do?
 [ ] Moves 30cm backwards [ ] Moves 20cm forwards [x] Moves 30cm forwards [ ] Moves 50cm forwards
The hedgehog has now drawn another side of the rectangle
6. The hedgehog is now in the bottom left-hand corner of the screen.

How many sides of the rectangle has the hedgehog drawn so far?
 [ ] 1 [ ] 2 [x] 3 [ ] 4
Altogether, a rectangle has 4 sides. The hedgehog has drawn 3 of the sides so far
7. The hedgehog is still in the bottom left-hand corner of the screen. The hedgehog is still facing to the left. Ella wants to make the hedgehog face upwards. What should Ella code?
 [x] Turn right [ ] Turn left [ ] Turn round [ ] Turn back
If the hedgehog turns right, it is soon facing in the right direction
8. Ella makes the hedgehog finish the rectangle. The rectangle is 20cm deep. What is her last line of code?
 [ ] Forward 30cm [ ] Stop [ ] Back 20cm [x] Forward 20cm
The hedgehog is now back where it started
9. The hedgehog has now drawn a complete rectangle. How many sides has it drawn?
 [ ] 1 [ ] 2 [ ] 3 [x] 4
A rectangle has 4 sides. How many sides has a triangle?
10. Ella has drawn a rectangle 30cm by 20cm. Her teacher now asks Ella to draw a rectangle 15cm by 10cm using the hedgehog.

Ella’s first line of code was: Forward 30cm.

What is Ella’s new first line of code?
 [ ] Back 15cm [ ] Back 30cm [x] Forward 15cm [ ] Forward 20cm
How much smaller is 15cm than 30cm? - It is half as long