This is a rectangle, but could you write a program to draw one?

# Code - How to Write Code 1

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.

Did you know...

You can play all the teacher-written quizzes on our site for just £9.95 per month. Click the button to sign up or read more.

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?
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?
The hedgehog turns right, ready to go down the screen
3. The rectangle must be 20cm deep. What does Ella code next?
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?
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?
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?
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?
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?
The hedgehog is now back where it started
9. The hedgehog has now drawn a complete rectangle. How many sides has it drawn?
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?
How much smaller is 15cm than 30cm? - It is half as long

Quiz yourself clever - 3 free quizzes in every section