Write this program using C programming. Make sure to include comments for each f
ID: 3765636 • Letter: W
Question
Write this program using C programming. Make sure to include comments for each function. And make sure to include the functions required.
Problem Specification:
The SAT Reasoning Test is a standardized test for most college admissions in the United States. The College Board recently announced changes in the SAT for 2016. The test will revert to the 1600 point system (it's currently a 2400 point system) and will no longer deduct points for incorrect answers.
To help high school students prepare for the SAT, create a program that presents a student with questions and provides them an overall score.
Task: Write a program that will ask a student multiple-choice questions and allow the student to type in a response. Immediately give the student feedback on whether they got the question correct or incorrect. When the program ends, it should give them a correct/incorrect summary report and display their percentage correct.
Each time the program is run, prompt the student for their ID, and prompt them for the number of questions they want to answer, from 3 to 5. Choose the questions at random from a provided file of questions. If they get the question wrong, show them the correct answer. Each time you display a question, randomize the order of the answers, so one time the question may be
Who's afraid of ghosts?
a) Allen
b) Beth
c) Kincade
d) Ghostbusters
e) none of the above
and the next time it might come up as
Who's afraid of ghosts?
a) Beth
b) Ghostbusters
c) Allen
d) Kincade
e) none of the above
The name of the file should be specified on the command line, as with
./a.out math.txt
Create your own 3 files to test, and show that you have tested each.
Your program should keep track of the student ID and the percentage of questions they got right in a separate output file created by your program, named with the word "student" followed by the student ID and a .txt extension, such as
student204590.txt
If this is the first time the student is using the program, give them a welcome greeting. If they've used the program before, show them their current score by reading it from their file before starting the questions.
Make sure you use appropriate functions to manage the files, as well as appropriate structures to manipulate the data.
The format of the file with the questions is as follows:
• a blank line separates each question.
• lines starting with alphanumeric text are the question to be asked.
• lines starting with "*)" are the choices for the question. There may be three, four, or five choices for each question.
• lines starting with a white space character are the answer, which must match precisely the correct choice.
Explanation / Answer
Hope this helps you
#define STUDENTS 3
#define ITEMS 25
main( )
{
char key[ITEMS+1],response[ITEMS+1];
int count, i, student,n,
correct[ITEMS+1];
/* Reading of Correct answers */
printf("Input key to the items ");
for(i=0; i < ITEMS; i++)
scanf("%c",&key[i]);
scanf("%c",&key[i]);
key[i] = '';
/* Evaluation begins */
for(student = 1; student <= STUDENTS ; student++)
{
/*Reading student responses and counting correct ones*/
count = 0;
printf(" ");
printf("Input responses of student-%d ",student);
for(i=0; i < ITEMS ; i++)
scanf("%c",&response[i]);
scanf("%c",&response[i]);
response[i] = '';
for(i=0; i < ITEMS; i++)
correct[i] = 0;
for(i=0; i < ITEMS ; i++)
if(response[i] == key[i])
{
count = count +1 ;
correct[i] = 1 ;
}
/* printing of results */
printf(" ");
printf("Student-%d ", student);
printf("Score is %d out of %d ",count, ITEMS);
printf("Response to the items below are wrong ");
n = 0;
for(i=0; i < ITEMS ; i++)
if(correct[i] == 0)
{
printf("%d ",i+1);
n = n+1;
}
if(n == 0)
printf("NIL ");
printf(" ");
}
/* Go to next student */
/* Evaluation and printing ends */
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.