US UKIndia

Every Question Helps You Learn

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

Writing Code - 1

This Computer Science quiz is called 'Writing Code - 1' and it has been written by teachers to help you if you are studying the subject at elementary school. Playing educational quizzes is an enjoyable way to learn if you are in the 3rd, 4th or 5th grade - aged 8 to 11.

It costs only \$12.50 per month to play this quiz and over 3,500 others that help you with your school work. You can subscribe on the page at Join Us

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
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?
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
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?
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
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
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?
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
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
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
Forward 15cm
Forward 20cm
How much smaller is 15cm than 30cm? - It is half as long
Author:  David Bland