This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-02-05 08:31:40

webmanoffesto
New Scratcher
Registered: 2011-02-09
Posts: 2

Interactive Quiz in Scratch, How to Make

I'm an English teacher and I want to create an online quiz which is more like a game than a paper quiz put online (e.g. HotPotatoes). I'm very handy with computers but new to scratch. I understand some of the basic concepts of programming (e.g. variables, if/then/goto, etc.).

Can you recommend a tutorial on how to make a quiz?
I found this
http://www.scratch.mit.edu/ext/youtube/?v=cFdgw6HKD9M
but it's not quite enough.

Also the "Super Hard Social Media Quiz" Scratch project  shows me this can be done. Although, I am concerned that this may take so much work that I'll go back to HotPotatoes.
SHSMQ Link: http://www.google.com/url?q=http://scratch.mit.edu/projects/EtherCreeps/2307722&sa=U&ei=AYQuT9H4N-G_0QXW6emtCA&ved=0CAQQFjAA&client=internal-uds-cse&usg=AFQjCNGj4x-6gCEueirpXtzjm_B7LUAy6Q

Offline

 

#2 2012-02-05 09:03:38

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

It doesn't take much time at all! Simply use the "ask block" and the if block together to see if the answer of the quiz is right, then make the sprite say something according to the answer and maybe add to a correct-answer variable if a question is correctly answered.

One question may be:

ask [Quiz: What is 2 + 2?] and wait
if <(answer) = ((2) + (2))>
say [Correct!]
change [correct answers v] by (1)
else
say [Wrong!]
end
Duplicate the blocks with right-clicking and then stack each script below eachother to create multitipe questions. Then place the "when green flag clicked" block above the whole script stack and then when you press the green flag, it runs.

However, they can see the answer when using Scratch 1.4. You would need to do it at home secretly, upload it at home, then at school show them the project on the internet.

Last edited by rdococ (2012-02-05 09:08:56)

Offline

 

#3 2012-02-05 13:39:36

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

rdococ’s example is good, but instead of

((2) + (2))
you could just use a four.  tongue


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#4 2012-02-05 14:06:24

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

henley wrote:

rdococ’s example is good, but instead of

((2) + (2))
you could just use a four.  tongue

I noticed that too  tongue


Why

Offline

 

#5 2012-02-05 14:29:16

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Interactive Quiz in Scratch, How to Make

Using 2 + 2 prevents others from seeing the answers during the prep time before they start presentation mode.


http://i50.tinypic.com/ded8m.png

Offline

 

#6 2012-02-05 14:41:17

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Interactive Quiz in Scratch, How to Make

An alternative method of showing it to your class without using the internet would be to use the presentation mode located in Scratch.

As rdococ said the main components of a quiz are ask and answer blocks.

Below is an explanation of how it works in detail, you can avoid this and go with the above solution if you understand it fine, though.

---

The ask Block

The ask block, shown below, allows you to enter a question to ask.

ask [question] and wait
The answer Block

The answer block then stores the answer, this happens automatically.

answer
Comparison using the If Block

This means that you can then compare the answer given with the actual answer using an if statement or an if else statement.

For example, if the question is 'what is the answer to 7 + 5?' you would use this code to ask:

ask [What is the answer to 7 + 5?] and wait
Following this up would be the code comparing it to the actual answer:

if <(answer) = [12]>
Then Something Happens Here
end
The say Block

Just having the answer compared to the actual answer isn't enough - you need something to happen if it's right.

Here the say block could be useful.

The say block allows the sprite it is held in to 'say' something.

say [That's Right!] for [2] secs
The above could be used if the answer is right.

Keeping Score

To keep the score of how many answers have been done correctly do the following:

Make a variable called score (or anything you like, really).

When you want to increase the score use:

change (score) by [1]
Combining Everything

Now you can combine everything so far to make a working question.

ask [What is the answer to 7 + 5?] and wait
if <(answer) = [12]>
say [That's Right!] for [2] secs
change (score) by [1]
end
What if I want it to say something when the answer is wrong?

Change the If Block to an If Else block like the one shown below:

if <>

else

end
And between the else part and the end of the block put what you want it to say:

ask [What is the answer to 7 + 5?] and wait
if <(answer) = [12]>
say [That's Right!] for [2] secs
change (score) by [1]
else
say [That's Wrong!] for [2] secs
end
Making a Quiz

Stack the above code one on top another and the questions will ask successively.

This code should come below the green flag button or another start block like When I Receive as all code must.


http://i50.tinypic.com/ded8m.png

Offline

 

#7 2012-02-05 16:26:41

webmanoffesto
New Scratcher
Registered: 2011-02-09
Posts: 2

Re: Interactive Quiz in Scratch, How to Make

Thanks for the help, I'm already making progress.

Another question:
If I want to present a series of questions how do I show three pictures at question 3 and then different pictures at question 4. They could be sprites (the correct answer is to click on picture 2) or just information that helps you answer the question.

Offline

 

#8 2012-02-05 16:37:11

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

Use the broadcast block.

when gf clicked
wait until < (question #) = (3) >
broadcast [question 3]
wait until < (question #) = (4) >
broadcast [question 4]
wait until < (question #) = (5) >
broadcast [question 5]
For the first three pictures:

When I Receive [question 3]
show

When I Receive [question 4]
hide
For the next three:

When I Receive [question 4]
show

When I Receive [question 5]
hide

Last edited by MoreGamesNow (2012-02-05 16:38:11)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#9 2012-02-05 16:49:09

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

You could also store the questions and answers in lists (make sure they're the same length) and use this script:

when gf clicked
set [count v] to (0)
set [correct answers v] to (0)
repeat (length of [questions v])
  change [count v] by (1)
  ask (item (count) of [questions v]) and wait
  if <(answer)=(item (count) of [answers v])>
    say [That's right!] for (2) secs
    change [correct answers v] by (1)
  else
    say [Sorry! That's wrong.] for (2) secs
  end
end
say (join (join (join (join [Well done! You got ](correct answers))[out of])(length of [answers v]))[!])

Last edited by joefarebrother (2012-02-05 16:54:10)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#10 2012-02-05 17:16:12

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Interactive Quiz in Scratch, How to Make

webmanoffesto wrote:

Thanks for the help, I'm already making progress.

Another question:
If I want to present a series of questions how do I show three pictures at question 3 and then different pictures at question 4. They could be sprites (the correct answer is to click on picture 2) or just information that helps you answer the question.

Hmm, I'd agree with MoreGamesNow.

Split your questions using the broadcast blocks.

Main Script - Broadcast blocks

Your main script in the sprite will look something like this:

when gf clicked
set (QuestionNumber) to [1]
broadcast [Question1 v]
wait until <(QuestionNumber) = [2]>
broadcast [Question2 v]
wait until <(QuestionNumber) = [3]>
etc...



The Question

Then you put in the questions, either in a sprite made to ask questions like a character or on the stage.

When on the stage the ask block appears at the bottom of the stage and looks better, in my opinion.

The questions would look like this:

when I receive [Question1 v]
ask [The Question] and wait
if <(answer) = [The Answer]>
broadcast [CorrectAnswer v]
end
The Correct Answer Speaking

Go to the sprite that says 'That's Right!' or whatever it says and put:

when I receive [CorrectAnswer v]
say [That's Correct!] for [2] secs
Making Pictures Appear

Assuming you want a maximum of 3 different pictures at a time, make 3 sprites.

Each sprite should have this in them:

when gf clicked
hide
stop script
They should also then have the script for showing the correct image for each sprite:

when I receive [Question2 v]
switch to costume [Costume_that_you_want_to_show v]
show
And finally a script to hide the image after the answer is given:


when I receive [CorrectAnswer v]
hide
---

Hope that helps.


http://i50.tinypic.com/ded8m.png

Offline

 

#11 2012-02-10 10:00:42

Connor-McIntosh
New Scratcher
Registered: 2012-02-10
Posts: 18

Re: Interactive Quiz in Scratch, How to Make

how do i make 1 full photos and words plz

Offline

 

#12 2012-02-10 11:12:40

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Interactive Quiz in Scratch, How to Make

Another thing you can do is use lists to store the questions and answers.

Questions List:

Code:

What is 2 + 2?
What is 5 - 1?
If Bob has 5 apples and Alice has 2 apples, how many do they have in all?

Answers List:

Code:

4
4
7

when gf clicked
set [score v] to (0)
set [i v] to (1)
repeat <length of [questions v]>
    ask <item (i) of [questions v]> and wait
    if <(answer) = <item (i) of [answers v]>>
        say [You are correct!] for (2) secs
        change [score v] by (1)
    else
        say [You are incorrect!] for (2) secs
    end
    say <join [You have ] (score)> for (2) secs
    change [i v] by (1)
end
say <join <join [You got ] (score)> <join [ out of ] <length of [questions v]>>>
You can take out all the says to keep the answers hidden. You can also easily add more questions and answers to the lists.  smile

I just realized this is almost exactly the same as Joe's script. Oh well.

Offline

 

Board footer