CompSci 06/101, Fall 2011, Quiz

vocabulary
image source
Clarifications since first posting are in bold.

There are several types of quizes written online for kids to learn facts such as freerice.com or quizlet.com . Some quizes work better than others. For example, some math quizes randomly pick digits between 0 and 12 for kids to learn multiplication facts, but can give too many easy questions with *0 and *1 which are pretty easy for kids and not test the harder facts with larger numbers as much.

You will write a quiz to help 3rd graders learn three types of information: multiplication/division facts, vocabulary and U.S. state capitals of states.

For the vocabulary quiz, you will read from a file in which each line has a word followed by a word or phrase with the same meaning, followed by three distractors on one line (with a colon (:) as separator). The quiz will give one word followed by four choices, one of which is the correct meaning of the word. Be sure to scramble the choices so they do not always appear in the same order when the question is given.

For the state capital quiz you will read from a file in which each line has the state followed by the state abreviation, followed by the capital city, followed by 0 or more cities from that state (with a colon (:) as a separator). The quiz randomly picks a state (or state abreviation) and four cities with one of them the capital city of that state. The three distractors should be randomly choosen first from other cities listed for that state and if there are not enough from cities in other states (choose from all cities in other states including the capital cities). Make sure the four cities listed are different. Note there are some duplicate cities in the file.

The math quiz will be generated facts of multiplication and division with the numbers 0-12 used for multiplication and the corresponding division problems (9*8 = 72, 72/8 = 9). The user is given a problem (9*8=) and must type in the answer. Note that 9*8= and 8*9= are considered the same problem. They both would not be given in the same quiz. 72/8= and 72/9= are considered different problems. problems.

The quiz starts by asking the user their name ( this is optional as the name is not really used for anything ), which quiz to start with and how many questions to ask. It then asks the user that many questions for that type of quiz. For any quiz the same question should not be asked during that quiz and the questions should be randomly generated. If the user asks for more questions than the total number available for that quiz, then just ask the total number of questions (such as 50 for the state quiz).

After the quiz the user is given their score (how many questions asked and how many correct). The user can take another quiz or quit. Quizes repeat until the user is ready to quit. If the user takes several quizzes the score is added to the previous score.

For extra credit

  1. The math quiz should categorize problems from easy to hard and whenever a question is missed a question in an easier category is asked the next time if possible.
  2. Enhance the state quiz so that it can also ask questions of the type that gives a city and 4 states (only one of which that city is the state capital for that state). Both types of questions (here is a state what is the capital, and here is a capital what is the state) should not be asked for the same state-capital pair in the same quiz.

Be sure to document in words how you setup each quiz.

There are four main parts to this programming assignment:

You should snarf the starting file and data for this assignment. You can see the data files here. See the HOWTO page for more details on the data format and other information.

Grading

Submit your source code: quiz.py and any other python files you create; as well as a README file and an ANALYSIS file using the submit name assign7-quiz.

In your ANALYSIS file, for each quiz, document briefly the main idea of how you create the quiz questions. you should also document any bugs or problems you have. If you document bugs that you cannot fix, and how you tried to fix them, they will affect your grade far less than bugs we discover in running your program.

If you did the extra credit, you should document which extra credit you did and briefly the main idea of how you did them.

You will be graded on how well you implement the quiz and whether you have included appropriate README and ANALYSIS files.