Short example Download it.
Try it online Extended example

QuizMaker is a Perl script that reads a relatively free-form text file, and builds a self-contained HTML/JavaScript multiple choice quiz of the type common in newspapers and magazines. Quizes consist of HTML text freely mixed with numbered questions that have (radio button) multiple choice answers. Scoring is done via client-side code, with no CGI needed; clicking the Score button opens a popup window with the score and its interpretation.

Source files consists of a series of paragraphs, separated by one or more blank lines. Paragraphs that start with a ?, *, or + are questions, score ranges, or quiz titles; all other paragraphs are passed untouched, as raw HTML text. C++ // and /* */ comments are supported. Leading white space on the first line of a paragraph is ignored; the first non-white character determines how the paragraph is treated.

Paragraphs that start with a ? are questions. Any lines after the first that start with text are part of the question; lines that start with a space are responses. Responses may end with an optional =Value, where Value is a positive or negative number; responses without a value have a default value of 0. For example:

?Where did his mother find happiness?
 The beauty parlor=-1
 A bottle of gin=-1

Paragraphs that start with a * are score ranges. The first line consists of an integer, optionally followed by a dash and another integer. Subsequent line(s) are the score interpretation. As with questions and responses, score interpretation text can contain any HTML markup you want to include. For example:

* 2-4
You got <i>some</>i of the questions right,
but you selected a few too many "close" answers.

Paragraphs that start with a + are quiz titles. The same title is used for the window title (HTML <title> tag) and the <H1> at the top of the quiz. You can have more than one + paragraph; the last one will be used. For example:

+QuizMaker Sample Quiz

All other paragraphs are passed untouched into the quiz file. This lets you add commentary and/or arbitrary HTML markup, like column breaks. Since the // in a URL looks like a C++ comment, \/ is an "escape sequence" that translates to /. So, you have to enter URL's as http:/\/ or http:\/\/ - sorry!

An example

 QuizMaker input  QuizMaker output
// JDS, 1-Dec-99

+QuizMaker demo quiz

This quiz was compiled
right on this page.

?Is QuizMaker easy to use?

?Is QuizMaker particularly useful?
 Probably not=1
 Of course not=2

*-3 - -1
Oh, get a life.

* 0
You are <b>so</b> wishy-washy.

* 1 - 3
Enclued you are.

QuizMaker demo quiz


This quiz was compiled right on this page.

  1. Is QuizMaker easy to use?
  1. Is QuizMaker particularly useful?
    Probably not
    Of course not

Quiz built by QuizMaker 1.0

Try it yourself


Copyright © 1999, Jon Shemitz, jon@midnightbeach.com