Computer Science 202
Systems Programming Concepts Using C
Lab 9 - On-line Test Administration System
Winter 1998


You are to write a program that will administer a test via the computer. Your program will read in a list of questions and possible answers. The user will be given the test one question at a time and their answers recored. Once the test is complete the program will grade the test and present the results.


Your program will use TWO input files. The first is the list of questions and the possible answers to each question. The first item in this file will be the number of questions. You can assume that each question has four possible answers ( a, b, c, and d ). The second file is simply the answer key.

Example of each of these files are shown below:

Questions file

What is the capital of Michigan?
Ann Arbor
What is the capital of Connecticut?
New Haven
Answer key file

Reasonable final output would be:

 Test Results: 
  Number correct: 2 out of 2  for a 100.00 percent.

Note that the test file contains the questions and answers only, and that each one is one a separate line. When these questions are presented to the user it would be nice if the options a), b), and so on were written in front of each of the possible answers.

The single input to this program is given on the command line and is the base name of the exam. If the base name was exam1 then the question file would be named exam1.test and the answer key would be exam1.key.

To discourage students from looking up each of the answers, each question will have a time limit of 15 seconds. If the student fails to answer the question in 15 seconds, then they get the answer wrong and move on to the next question.

In Class

Demonstrate that your program can read in the .test file and correctly display the first question on the exam.


The following must be delivered to your instructor via text-only email no later than midnight of 11th Monday.
  1. Source code for your program.
  2. Sample test questions. NOTE you cannot use the sample test given here, be creative and generate you own.
  3. Sample test answers.
In addition, you must deliver to the instructor at the start of class (Lab) on 11th Tuesday the following:
  1. A printed copy of your source code.


  1. I suggest getting the program working without the time limit first, then add in the time limit.
  2. Partners are allowed in this lab, BUT NOTIFY ME IN WRITING.