Problem Solving in Scratch!

Learning Objectives

  • Combine the skills learned so far to create a more complex piece of software
  • Make sure the software is meaningfully commented
  • Research questions to make an interesting quiz

Learning Outcomes

All must Expand on the ideas from the previous lesson to create a fully interactive quiz (Level 5)

Most should Add meaningful comments to the code, explaining how the code works. Find and use appropriate images to expand the quiz. (Level 5)

Some could complete the above with no help, making sure the quiz is fully working and correct. (Level 6)


Words to learn:  commenting code


Start off by opening Scratch 2.  We are going to expand on the idea of branching stories, iteration, and broadcasting/receiving messages by creating a fully interactive quiz.

Click here to download the quizMaster program to your H: drive and open it in Scratch 2.

Add this code to your Quizmaster sprite:

(When you use the “broadcast” blocks, you’ll have to click the drop down menu, choose New Message… and type the name of the message, e.g “question 2”)

Run this code.  It should work well… up to a point.


Add another maths question : “Name the first 5 numbers in the Fibonacci sequence.”  The correct answer is 0,1,1,2,3  Make sure this works correctly.

Main – Commenting code

At this point it is vital you learn to start commenting your code.  You will very soon have a lot of code on the screen, and it can be difficult to read, and understand without comments, or notes written by the programmer to make things more readable.

Next to one script, right-click on the screen, and select “add comment”.  This gives you a little box in which you can type an explanation of your code in normal English.

From now on, make sure all your code is well commented!


Now you’ve got a couple of successful quiz questions, expand your quiz so that you have a full – blown interactive quiz.  Once you are finished, take screenshots of your program and stick them into your exercise book.


Modify your script to do the following:

  • Have a score that increases by 1 if the player gets the answer right, and takes 1 away each time they get an answer wrong
  • Tell the user their score at the end of the game
  • Praise or ridicule the user depending on how high (or how low) their score was

Once you finish the extension, take a screenshot of your modified script and stick it into your exercise book.