Scratch 08 · Make a timed quiz

A quiz screen beside a stopwatch.

Scratch lesson 8 of 10 · Early intermediate · About 35 minutes

Program a space courier quiz that reads answers, awards points and measures how long the full round takes.

What you’ll make Use ask and wait, the answer reporter and if/else decisions to build a three-question quiz. Save the elapsed time and give the player a goal to beat on their next try.

Get ready

Open the Scratch editor (opens in a new tab) and start a new project.

  • Open a new Scratch project. Pick a character to run the quiz and rename it Host. Choose or paint a space backdrop if you like.
  • Make two Variables for all sprites named Score and Elapsed. Keep the Score monitor visible and untick Elapsed, which the host will report at the end.
  • All three questions go in a single stack on Host. The round uses a stopwatch. It measures the time and checks a target, while giving the player time to submit each answer.

To keep your project, choose File → Save to your computer in Scratch.

Start the clock. Set score and timer. → Ask and check. Compare each answer. → Show the result. Count points and time.
Project flow · Start the clock → Ask and check → Show the result

Build it in Scratch

Choose the sprite named above each stack. The colours help you find the block categories. Indented rows sit inside the block above. Follow the end marker to see where each loop or condition closes.

1. Reset the round and ask the first question

Select Host. The green flag sets up a fresh round. The first Looks block displays the rules for two seconds. Put reset timer after the introduction so the player has time to read the rules. Find ask and wait in Sensing. Scratch pauses this stack until the player types an answer and presses Enter or selects the tick. The rounded answer reporter holds whatever they submitted.

Block stack for Host
when green flag clicked
show
set [Score] to (0)
set [Elapsed] to (0)
say [Type the three number codes. Aim for 3 points in under 20 seconds!] for (2) seconds
reset timer
ask [Code one: What is 3 × 4?] and wait

2. Check the first answer and give feedback

Snap a Control if then else block underneath the first question. Drag the green = block into the condition space. Fit the light-blue answer reporter on the left and enter 12 in the text slot on the right. Put the score change and the correct message in the first arm. Reveal the correct code in the else arm. Use the Looks say for seconds block in both arms. Both paths take one second, and each answer gives one point or zero points.

Block stack for Host
if <(answer) = [12]> then
change [Score] by (1)
say [Correct!] for (1) seconds
else
say [The code was 12.] for (1) seconds
↳ End of block

3. Add two more code locks

Put the next question below the whole first if/else block, so it runs after either answer. The second question works the same way as the first. For question three, capture the Sensing timer in Elapsed immediately after the player submits. The stopwatch includes the two one-second feedback pauses between questions. Keep this timing rule when testing your own record. The third check only needs an if then because the final result is coming next.

Block stack for Host
ask [Code two: What is 20 minus 2?] and wait
if <(answer) = [18]> then
change [Score] by (1)
say [Correct!] for (1) seconds
else
say [The code was 18.] for (1) seconds
↳ End of block
ask [Code three: What is half of 10?] and wait
set [Elapsed] to (timer)
if <(answer) = [5]> then
change [Score] by (1)
↳ End of block

4. Read out the score and time

Attach these blocks to the bottom of the same stack. The green join reporter combines a label with the value next to it. Leave a space after each label inside its first box, then drag in the variable or round reporter on the right. The round block makes the displayed time easier to read. The last condition checks the saved time before rounding, so a rounded display of 20 can still be slightly under 20. Fit the two comparisons into a green and block to test both at once.

Block stack for Host
say (join [Score out of 3: ] (Score)) for (2) seconds
say (join [Seconds, rounded: ] (round (Elapsed))) for (2) seconds
if <<(Score) = [3]> and <(Elapsed) < [20]>> then
say [Speed star earned!]
else
say [Click the flag to try another round.]
↳ End of block

Test your project

  1. Enter 12, 18 and 5 fairly quickly. Score should be 3 and the host should award the speed star if the saved time is under 20 seconds.
  2. Start again and enter 99 for the middle answer. With the others correct, the final score should be 2 and there should be no speed star.
  3. Leave the first question open for more than 20 seconds, then answer all three correctly. You should get 3 points and the replay message. Click the green flag again to start from zero.

If something goes wrong

A correct answer never counts.
Check that the blue answer reporter is snapped inside the green equals block. A typed word answer will not read what the player entered.
Questions appear in the wrong order or the quiz will not continue.
Make sure there is only one green-flag stack and that each ask block follows the preceding answer check, outside any if/else arm.
The time is several seconds longer than expected.
Capture Elapsed immediately after the final answer. The closing speech bubbles run afterwards and should not be counted.

Make it your own

  • Write three questions about animals or space. Change every matching answer, and use a prompt that makes the reply format clear.
  • Change the target to 15 seconds in both the introduction and the final check. Play a few rounds and decide whether the new goal feels fair.

What you’ve learned One question at a time makes it easy to tell which answer you are checking. Saving the timer reading finishes the timed part while the host is still free to show results.