Question
A multiple-choice quiz has a total of 15 questions. Each question can either be: A, B, C, D, E (five choices). All data for that
A multiple-choice quiz has a total of 15 questions. Each question can either be: A, B, C, D, E (five choices). All data for that exam is stored in a file quiz.txt. The first line of data contains the correct answers to the 15 questions in the first 15 consecutive character positions.
For Example: ABBCBBEDCEDBCCA
Each line in the file contains the answers for an individual student. Data on a line consists of a student ID (integer), then by a space, followed by the 15 answers given by the student in the next 15 consecutive character positions. An X is used if the student did not answer one of the questions.
For example: 1225 ADBCXCXECAXABCA
There is no limit to how many students there are. A line containing a studentID 0 indicates the end of the data.
A students overall total score is calculated by adding up points. Points for a question are calculated as shown: Correct answer = 5 points, wrong answer = -2 points, no answer = 0 points
.
Write a C program that prints:
1. Each student ID and there overall total score
2. The total number of students
3. The number of correct responses to each of the 15 questions individually(example:
Question Number: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Number correct: 5 8 2 9 8 5 3 2 8 4 9 4 6 7 9
Hint: For loop's and three array's must be used. Basic program for beginners.
Use appropriate variable names (example: int correct=0, wrong=0, noattempted=0, char answers[16], char studentanswers[16], char correctnumberanswers[15], etc.)
.
Sample data in quiz.txt
ABEDEEBCEABBCCA
4564 ABEXXBXECDDCBAA
2216 ABEDEEBXXEDEACA
8532 BBEEEBXECDDCBAA
5829 ABEEABEECDDCBAA
7721 CBEXBBXECDDCBXX
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started