Message Boards Message Boards


Test Scoring Application

Posted 10 years ago
1 Reply
1 Total Likes
I have an assignment where I have to create a code to check over a group of students choices for a mock test and determine if the value is correct and return a score for the students and determine if they pass or not.

"Write a Mathematica program to correct the Permit test for the DMV. The program should read a list of names and answers and compare them to the correct answers. The student scores should be imported from the file student. The correct answers are stored in the file correct. If the student gets at least 7 correct answers, he/she passes the test. The program should print out the student name, number of correct answers, score and Pass/Fail.
EX: Sally Smith 8 correct questions 80 PASS
You will need to import both files into your program."

How would I attempt to do this I am extremely stumped on the whole thing anyone have some input?
POSTED BY: sam maclaren
Well, obviously it's your assignment, and you're presumably able to do this to some extent (otherwise you went into the wrong classroom emoticon), so we can't  be of too much help. But here are a few suggestions:

1. Break the task down into smaller steps. Then you can only be stumped on 'the next step', rather than the whole thing.
2. Learn the basics of Mathematica. So visit YouTube, or and watch a few videos. Read the Virtual Book in the Mathematica help or some of the tutorials.
3. Find out how to import files. Seaching for 'import' will bear much fruit. You have to know the file format of the files "student" and "correct" - tab-separated, comma-separated, or what? You could probably import the names and scores into a table - a list of lists.
4. A basic skill in Mathematica is to chop and slice lists. Use double brackets (aka Part) for list access. You can get columns from tables too.
5. Write a function that takes two lists, one containing a student's scores, the other containing the answers. Find out how to compare two lists. This might involve...
6. Finding out how to map a function over one or more lists. This could be useful for comparing the values and storing some results. MapThread is cool...
7. Comparing a student's answer against the real answer is easy if the answers are numbers. Multiple choice is OK too. Otherwise you'll have to know about comparing strings... 
8. The Count function can count values in lists. If the Count of correct answers is greater than or equal to 7, the student passes. 

It's not a lot of code (about 10-20 lines?) but if you haven't learnt the basics of the language, it might be quite challenging until you have.
POSTED BY: C ormullion
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract