CS201
Lab 8 - 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 BEFORE
THE BEGINNING OF YOUR NEXT 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.
There is no need to worry about any other data/input the textbook's
authors want you to read from. fgetAnswers needs to read only from
a keyboard or a re-directed file.
- To read and write from/to files, you run your program
by doing:
$
Lab8 < 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
(i.e. you cannot declare a constant here!). 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! :)