This week, I was invited to speak at the National Videogame Arcade Teacher User Group and specifically about how we can link Computing to other subjects. The most cross-curricular tool I have used so far is quizzes in Scratch: so there was my focus. We started by talking about the algorithm for a quiz – what’s the step by step instructions? We came up with ideas such as:
- evaluating an answer with some kind of “if” statement to find out whether it is correct or not
- a multiple choice set of answers, with the user to click on the one they think is correct
- how to determine whether spelling will matter or not
- keeping score by adding 1 to a score variable every time an answer was correct
- whether to lose a life or end the game if the answer is wrong – or to keep on asking the same question until it is answered correctly!
I delved into the huge repository of quizzes on the Scratch community to come up with some examples for us to look at. A lot of these quizzes were coded by children and so had mistakes, colloquialisms and crazy concepts – and that’s why I think they are great to use as a starting point!
This Geography Quiz is hosted by a talking unicorn (which is always a good thing in my view) and features ten questions about the capital cities of various countries.
Looking inside at the code, the questions are coded one after another in sequence. The unicorn asks a question,and then waits for user input, with the inbuilt Scratch block answer holding that input. A variable correct holds the answer and an if statement evaluates to see if answer and correct are the same.
Feedback is given by the unicorn to say if the answer is right or not, and there is no score kept.
I chose this Tudor quiz because it was an example of a quiz as an activity relating to a topic. It’s also very interesting because it uses a series of buttons on the screen to ask the questions and evaluate the answers.
The Quiz and Next buttons are coded to ask the two questions and the A B C and 1 2 3 buttons give the user feedback about whether the answer is correct or not. The advantage of this design is that the code needed is very simple and sequential – there is no need for variables to hold values or selection to evaluate user input. The disadvantage is that it relies on the user clicking on the right buttons in the right order. The “extra” feature is the inbuilt Scratch timer which times the user and tells them how fast they were at the end, which adds a nice competitive slant.
As a quiz structure, it’s a good starting point for younger children to code because of these features.
Scratchy’s Times Tables Quiz
I chose the Times Tables Quiz example because it’s one of the most commonly used formats for quizzes so it’s always useful to look at because of the coding that’s going on underneath.
This particular quiz is very neatly and efficiently coded, using a score variable to keep a count of the correct answer. A repeat loop asks ten times tables questions. Two variables, num1 and num2 are the two numbers to multiply together, and the Scratch block pick random chooses a random number between 2 and 12 for these. Another variable total holds the sum of num1 multiplied by num2.
This quiz also used the join block to append text, such as joining the first number and the second number together in the question, and joining information that the answer was wrong to the correct answer.
Using sequence, selection, repetition and variables are all requirements of the Key Stage 2 Computing curriculum.
When I thought about how to design a spelling quiz in Scratch, my first thought was to have a multiple choice style quiz, with four different answers, one correct and the other three similar but wrong. When I researched this in the Scratch community though I found interesting examples in Scratch.
This spelling quiz uses sound to record a child speaking the word to be spelled. The concept is ingenious, the code is sometimes buggy, but it asks the user to spell the names of five different animals. There are four variables declared, although I can only see one, score, used in the actual code. What’s really interesting is the use of lists in Scratch to keep a bank of words to be spelled, a way of picking these at random and a bank of sounds to play. After each question, the bank of sounds is deleted and regenerated.
Compare the code with this example, which I’m almost certain wasn’t designed by a child, although the responses certainly were!
Again there are a bank of sounds which are grouped together in a list called Spelling. They are called at random by a variable randomiser which is assigned to one of the items in the Spelling list. An ask block is used to get the input of the spelling from the user and the inbuilt Scratch block answer evaluates this input to see if it is the same as the spelling of the word.
I’ve never explored the possibilities of the list block in Scratch before, so I read up on how it works in the Scratch wiki. In other progamming languages, it’s called an array. It’s beyond the remit of the Key Stage 2 curriculum – but I argue that this makes it even more interesting to include as a challenge to stretch the more able in Year 5 / 6.
This code is an example of efficient, reusable code – efficient because it’s programmed with the minimum amount of blocks (as far as I can tell!) which makes it easier to read and decipher for an experienced user and reusable because it could be adapted to different spellings by recording new sounds.
The Impossible Quiz
A blog post on quizzes wouldn’t be complete without a reference to the Impossible Quiz. I found out at the NVA Teacher User Group that these were originally coded in Flash. Hats off to the people who have recreated this in Scratch!
With 85 sprites and 336 scripts, it’s not one I would recommend for use in the classroom to look at the code as an example. But it’s a great one to try for testing your quiz skills – or the childrens’ quiz skills to see which are better!
If you’ve got any good examples of quizzes in Scratch, then please add comments below – it would be great to build up a bank of resources to compare, reuse and discuss!