Javascript Quizzes
In the summer of 2004 my wife was teaching an online course at Northhampton Community College, and
was using a program that came with the textbook to give online quizzes. The program had a serious
drawback - when the student was finished with the quiz, the program would tell them the correct
answers to the quiz and then ask them to submit it. Most students naturally would choose not to
submit it, and instead go back and retake the quiz and get a perfect score. I offered to write some
code to allow her to make her own online quizzes. Follow
this
link for a sample quiz.

The code works as follows: My wife made up the questions using Microsoft Word, copied the
questions into the Paint program which comes with Windows and saved each question as an image file.
This is due in part to the fact that displaying mathematics in HTML is usually not pretty. In HTML
4, there is a way to display math, but this is not necessarily supported in older browsers, so I
decided to go with the safest method, saving the formulas as image files (note that there are many
ways of accomplishing this, and neither of the above programs is necessary).
The quizzes are 10 questions long. The code chooses from between two alternatives for each
question and mixes up the questions in a random order. The number of questions and choices for each
question can easily be modified. When finished, the student submits the quiz, and then is told how
many questions they had correct. One drawback is that a smart student could select
view source,
and figure out the answers from the code (they are in there!), but I've tried
to hide them by obfuscating the code sufficiently that it would be more work to find the answers
than to take the quiz.