CS 201
Lab 9- Grade Multiple Choice Exam
Objectives:
- Grade an n-question multiple-choice exam (for n between 1 and
50). Provide feedback about the most
frequently missed questions.
Readings:
- Read Chapter 8 in the Hanly/Koffman text.
Deliverables: (DUE 72 HOURS AFTER THE END OF YOUR LAB).
- Submittal of the following files:
- Makefile
- Proto.h
- Lab8.c
- GetAnswers.c
TO DO (for this lab)
- Design and Write a program to solve Programming Project #1
on page 422-423 of the Hanly/Koffman text.
- The book mentions "an open input file" and an additional case when you
may need to call function fgetAnswers. I want
you to use
redirection to read from a data file and to write to a data file.
This means you use regular scanf and printf
functions. Function fgetAnswers needs
to read only from a keyboard or from a re-directed file.
- To read and write from/to files, you run your program by doing:
$ Lab9 < examdat.txt > report.txt
- Sample input file (e.g.
examdat.txt):
5 dbbac
111 dabac
102 dcbdc
251 dbbac
The first line of input file includes: (1) the number of questions that were
given during a test, (2) single space, and (3) the correct answers listed one
after another (no space there!). Assume, there cannot be more than 50 questions,
and that the number of students is unknown. Assume every student ID is a unique, 3-digit integer. The rest you can learn from the textbook... :)
Sample output file (e.g. report.txt):
Exam Report
Question 1 2 3 4 5
Answer d b b a c
ID Score(%)
111 80
102 60
251 100
Question 1 2 3 4 5
Missed by 0 2 0 1 0
Helpful Hints
The following links show the format of the input and output files
expected. You can use them for testing if necessary. Good luck! :)
Grading Scheme
Program compile and execute 20%
Program meets all specifications 60% (e.g. makefile, proto.h, input/output, etc. Also ask your TA specifically about what preciously he is looking for)
Program follow code conventions and contain proper documentation. 20%