Scratch Part 8: Quiz

The latest version of Scratch includes some commands that make it easy to create quizzes.

Under Sensing there is the Ask ??? and wait command.

Also under Sensing is the answer variable, which stores the answer provided. Finally, there is a Reset timer command that can be used to set time limits on questions.

For a given question an algorithm might be:

  1. reset the timer
  2. ask the question
  3. if the answer is correct then
  4.  show a message
  5.  increase the score
  6. else
  7.  show a message

A slightly better version is:

  1. reset the timer
  2. ask the question
  3. if the answer is correct AND the timer is less than the maximum value allowed then
  4.  show a message
  5.  increase the score
  6. else
  7.  show a message

To make the conditions for the if statement we use an = block with the blue answer variable on the left and the correct answer on the right, for example:

We need a variable for the total score. You should be able to construct your own quiz from this point.

For some answers you may want to make use of the OR expression, or even NOT. For some answers it may be useful to allow alternative capitalisations e.g. Paris or paris might be the correct answer.

Task 12: Make A Quiz

Use techniques similar to those described above to make your own quiz.