Computer Science A Journey to discover how technology works

Home CS Planning DL Planning Schools Phil Bagge Articles Getting Involved Links Contact Blog Courses
Maths Quiz
New quiz planning is here
In this module pupils are introduced to the ideas of selection and using a simple variable to record the score. Once the basic concepts are learnt pupils can adapt them to create quizzes on any topic or theme. The quiz can be adapted to include changing the background once a question is answered correctly using the broadcast command. There is evidence to suggest that pupils who make a quiz on a subject retain the subject knowledge for longer. It is a really good idea to limit this to a Maths quiz with numerical answers for their first attempt as numerical answers are easy to check for correctness. If your answer is London you may know the right answer but spell it wrongly or miss the capital letter.
Notes Scratch 1.4 Scratch 2.0

Explain that pupils are going to make there own Quiz game.

Load a blank copy of Scratch.

Demonstrate how to delete the cat.

Right click on the cat sprite and left click on delete
scratch1.4delete
Left click on the cat sprite

Left click on the scissors on the top bar

Now left click on the cat to delete it

Demonstrate how to import a single character to ask the quiz questions.

Explain that on no account must they delete this sprite once they have started coding as they will lose all their work. You will have to repeat this during this module as there is always someone who ignores it!

Left click on the middle choose new sprite from file button

Choose a sprite from either the Animals, Fantasy or People folders
Left click on the choose new sprite from library button

Choose a sprite from either the Animals, Fantasy or People sections

Explain that most of the code in this unit will be in one block. Starting at the top and working down.

Insert a green flag block and ask pupils what block they would use to welcome the user to the quiz? Hopefully they will remember the say or think blocks used during the conversation.

From the control and looks sections drag these blocks into order.
Test the code to make sure it works.

From the events and looks sections drag these blocks into order.

Test the code to make sure it works.

Introduce the idea of selection

Use this resource to explain how selection works in the real world

Drag out the if else block and explain that this block allows the program to go down different paths depending on the answer of the user just like our choices in real life.

Now arrange these blocks as shown on the top right.

Explain that the light blue ask block is very different from the say and think blocks. It asks for an answer and stores that answer inside the oval answer block. (Which is a form of variable but avoid this here)

As you drag out the green = block ask pupils what = means? Make sure you get to the same as.

Before running the code go through it manually. Explain that the ask block is asking for an input from the user. Their answer will then be stored in the answer block. If the users answer is the same as the number we typed on the right the top if block of code (say correct) will be run. If the users answer stored on the blue oval is not the same then the else code (say wrong) will be run. Stress that you can't run both correct and wrong.

Now run the code a couple of times getting your answer right and wrong.

Give pupils time to make this and other questions underneath.

You could decide on an audience for your maths quiz or leave it up to your pupils although questions that they themselves can answer themselves is important.


Pupils will now create their own questions similar to these


Pupil will now create their own questions similar to these

Ask pupils what is missing from this quiz? Most groups will come up with a way to record the score.

Explain that you are going to create a variable to hold the score. Explain that a variable is something that changes. I often talk about the weather being variable or peoples moods being variable.

Explain that a variable is like a box that can contain anything and that the computer can keep a record of what is in the variable/box and let us know what is in it at any time.

Create a variable

Left click on the orange variable blocks button
Select Make a Variable

A pop up menu will then ask you to name the variable

Score is a good name but there is nothing wrong with the user thinking up a different scoring name

Point out that if you tick the box the variable is shown on the stage.

If you un-tick the box the variable disappears from the stage although it is still working in the background.

Left click on the orange Data blocks button
Select Make a Variable

A pop up menu will then ask you to name the variable

Score is a good name but there is nothing wrong with the user thinking up a different scoring name

Point out that if you tick the box the variable is shown on the stage.

If you un-tick the box the variable disappears from the stage although it is still working in the background.

Add variable blocks to your quiz. Ask your pupils how many points users should start the quiz with? Insert the set score to 0 block. You might wish to discuss quiz scores as not all quizzes starts with zero.

Ask pupils what block they think they should use to increase the score when users get the answer right?

Someone will normally come up with change score by 1. Ask pupils where they think it should go. Lots will say under the say correct block. This is in the correct part of the if else selection but the program will say correct for two seconds before the score is increased.

Now run the program through getting questions right and wrong and watching the computer keep track of the amount in the variable. Get a pupil to stand next to you with a box called score. Model the program manually and add pencils into the box when you get answers right.

You can also discuss what pupils would do if they wanted to take away points for wrong answers. Most classes will come up with changing the score by -1. This makes for a more interesting score but stops recording how many questions are answered correctly.

Allow pupils plenty of time to build up a body of questions and add a scoring system testing it as they go. You may wish to show them how to duplicate a question by dragging off a set of blocks and right clicking and then duplicating it.

Common Errors

Many pupils place blocks inside each other by mistake. This is so easy to do and can easily be missed.

It often occurs when pupils are duplicating groups of blocks. Getting pupils to compare their code with yours in a specific area helps them to debug it.

Optional Refinement


Change the background if you get an answer right

Import or draw a background. Copy it and adapt it to say correct or indicate some form of celebration.

Name the backgrounds normal and correct

 

Click on the background tab in the stage area

Create a broadcast called correct and put it in the if section above the change score by 1 variable

In the stage area pick up the broadcast and switch to background called correct for 1 second before switching background back to normal. Make sure you also have a green flag linked to the normal background so that you start the quiz on a normal background.

Where to place the correct broadcast

In the stage area place this code
Where to place the correct broadcast

In the stage area place this code
I recommend letting pupils make their own quiz with a genre of their choosing as the next activity.
 
Asking the big questions
pythoncode cas wessex conference link