ABSTRACT

Multiple choice or free text? The easiest way to write a quiz program is to use questions that have multiple-choice answers. The advantage of using multiple choice is that any answer the user gives is either definitely wrong or definitely right. There is no ambiguity. Computer programs hate ambiguity. The disadvantage is that the quiz compilers are required to create the alternative ‘wrong’ answers, which adds to their work. Free-text input is prone to errors. A quiz that allows free-text input for the answers must have answers that are very easy to input. Numeric answers are the least prone to error, but even here there are possible problems; if the answer is ‘3’, how do you respond to an answer of ‘three’? Both answers are correct but if the code is checking for ‘3’ and finds ‘three’ then the player could easily be marked wrong. Free-text input is very demanding to code; many answers that are incorrectly spelt must be marked as correct. But how do you allow for that? One way is to compare the player’s answer with the correct answer using a table of permissible, wrongly spelt answers. But however you approach it, the problem is complex and can result in ‘obvious’ wrong answers being marked correct and vice versa. In this chapter we are, therefore, only going to consider the multiple-choice option. In the database of quiz questions we will keep the correct answer and three incorrect ones for each question.