A Quiz about the Quiz Tool

quiz.pl is a script that processes a file in a simple format to produce a quiz that uses an HTML form to accept the user input, and JavaScript to process the input. With JavaScript, the quiz is scored and text is presented that depends upon whether each question was correctly answered. If the user's browser doesn't support JavaScript, the quiz is still presented, but the output is static.

The purpose of the quiz you are taking now is to describe how to code the quiz source that, once processed by this script, generates two HTML files that implement the quiz: the file used for user input, and the file used to score the quiz.

Learn to write you own quiz by reading this text, reading the source for this quiz (which is called quiz.quiz), and perhaps by reading the Perl source for the quiz generating software, which, again, is called quiz.pl.

Right now, you are reading the contents of the quiz header. The quiz header is text that is presented before any questions are asked. This section is introduced by a token that reads >>QUIZ-HEAD and is followed by one or more lines of text.

1. What token starts the quiz header?
>>QUIZ-FOOT >>QUIZ-HEAD
2. The quiz is titled using the >>QUIZ-TITLE line. Such a line starts with >>QUIZ-TITLE followed by the title of the quiz, one or more words, on the same line. What token introduces the quiz title?
>>QUIZ-WHIZ >>QUIZ-TITLE
3. Each question in the quiz is introduced by the >>QUIZ-QUEST token. Three types of entities exist in this section:
  1. the question text
  2. the answers
  3. the text to display with the scored quizThese entities can be in any order. The text of the question follows the Q token. That must be the first token on a line, followed by the text of the question on one or more subsequent lines, each of which must start with the Q token. There are two types of answers: right answers, and wrong answers. They may be displayed each on a line by itself-- in rows-- or all on one line-- in columns. Each answer is introduced by a two-character token: R for row or C for column, followed by W for wrong or R for right, or correct. That's followed by the text associated with the answer, on a single line. Which of the following is a valid token for introducing an answer?
RR CW CC
4. You specify the text to be printed if the question is correct, the text to print if the answer is wrong, and the text to print in either case, introduced by the single-character tokens R, W, and B, respectively. The text starts on the line with that token, and may continue on subsequent lines (which must also start with R, W, or B. Pay particular attention to the text printed for both correct and incorrect answers, because this is all that a user with a JavaScript-challenged browser will see. Did the Seahawks stadium bond issue pass?
yes, it did no, we came to our senses
5. The only type of question supported by the quiz is multiple choice with a single answer. That means that you can't ask a user to check all the correct answers. That sounds severe until you realize that most modern multiple choice tests have the same limitation. Remember, too, that a true or false question is really a form of multiple choice question. True or false: you can submit essay questions with this software.
true false
6. That's pretty much it, except for two more tokens: >>QUIZ-FOOT and >>QUIZ-RFOOT specify text to be displayed at the bottom of the quiz and the result, respectively. That reveals another limitation of the software: the quiz consists of leading text, followed by questions, followed by trailing text; the result consists of leading text, followed by answers, followed by trailing text. That's a bit rigit, perhaps, but you can always go in and edit both the quiz and the results after generating the quiz. Don't do that, though, until you are perfectly happy with the output of the software, because if you run it again, you'll lose your edits. And, you can embed HTML tags in your input to get sexier output.

We've seen examples of everything so far except row-formatted answers. Why do you think that is?

I was saving the best for last.
I forgot until now.
No reason. Some things just are
This is the quiz footer, mentioned above. When you press the submit button, above, you'll see the results page.