A Generic Quiz Structure

This method has been used in HyperCard, Toolbook, and Director. The structure calls for any number of questions, each with 4 possible answers. For each answer, feedback is provided. Everytime the quiz is entered the order in which the questions are presented is changed; every time a quiz question is displayed, the order in which the answers appear is also shuffled.

The most elegant implementation I've done (IMHO) is a Director shockwave version that we have even created a desktop application that can create all of the files needed for your own quizzes. Director source code is served in my NoJava shop.

The Method

SetupQuiz

  1. set global variables
      
      qMax=       the number of questions (may be hard 
                  coded or determined
      	          by checking number of screens)
      qList=      an item list from 1 to qMax (i.e. 1,2,3,4,5...)
      qPointer=   the pointer to the current question number, set
                  intially to 0
      qScore=     number of correct answers (set to 0)
      
      
    
  2. Randomize qList
    Can be done by using external function or calling a sub handler:

Navigating

A nextQuiz handler is called each time the mouse clicks on a :next" button. In this handler, the value of qPointer is compared to qMax:
if qPointer = qMax then -- this was th elast question
  go to the Report Screen
else
  increment qPointer
  go to quiz question number qPointer in qList 
end

SetUpQuestion

For each newly viewed quiz question:
  1. Update the counter display ( i.e put qPointer "of" qMax into field "counter")
  2. Randomly shuffle the location of the 4 fields that contain the answers. These are named "ans1", "ans2", "ans3", "ans4".
  3. Resets a flag that indicates whether the user has tried at least on answer
  4. Hide the "next" button

Checking Answers

Each answer field responds to a mouse click by calling a checkAnswer handler. This routine:
  1. Determines which field was clicked
  2. Displays an associated feedback field (i.e. show field "feedback2")
  3. If this is the first answer checked for this question, checks it against an answer key. This can be stored as the name of the card/page, or in an invisible text field. If the answer is correct, increment qScore.
  4. Display the "next" button

Scoring

The feedback for the scoring depends on the application. One can check the percentage against some compentency level, offer a chance to retake the quiz, etc. There are also many other ways to score rather than accepting the first response (we have also done it by scoring the last selected response before the user leaves the quiz screen)

Examples