CSC 551: Web Programming
Spring 2002
HW3: JavaScript Programming
Create a Web page named quiz.html that can be used to conduct multiple choice quizzes over the Web. The page should contain at least 10 potential quiz questions, each with three possible answers (A, B, and C). When loaded, the page should first prompt the person for the number of desired questions in the quiz, with a default of 5 questions. The page should then randomly select questions and prompt the user with each question and possible answers. Each answer entered by the user should be compared with the correct answer, and the result displayed within the page (either CORRECT or INCORRECT). At the end, the number and percentage of correct guesses should be displayed in the page.
Note: the specific look and feel of this page is left intentionally vague, allowing considerable design freedom on your part. Your page must be clear and understandable to the user, and support the following:
- It must be straightforward to add or remove potential questions, with a minimal amount of editing.
- It must display each question and all three potential answers as part of the prompt, and make it clear to the user how their answer should be formatted.
- The question, user's answer, and correctness of that answer must be displayed in the page. In the case of an incorrect answer, the correct answer must be identified.
- The number of correct answers, total number of questions, and correctness percentage must be displayed in a readable format.
- For extra credit, ensure that no question appears more than once in a specific quiz. Of course, this requires checking to make sure that there are enough potential questions to complete the quiz.
For example, the page might contain the following as a result of a 5-question quiz:
What is the capital of Missouri?
You guessed B) Jefferson City
CORRECT
How many ounces in a pound?
You guessed A) 10
INCORRECT: the correct answer is C) 16
Who was the first person to set foot on the moon?
You guessed C) Neil Armstrong
CORRECT
Who holds the Major League Baseball record for most home runs in a season?
You guessed A) Barry Bonds
CORRECT
In what year was Creighton University founded?
You guessed A) 1778
INCORRECT: the correct answer is B) 1878
You answered 3 out of 5 questions correctly (60%).