Question: You are grading a multiple choice e x a m that consists of five questions. Note that the possible answers are a, b, c, d,
You are grading a multiple choice e x a m that consists of five questions. Note that the possible answers are a, b, c, d, or e. Write a program that asks the user to enter the solutions to the e x a m (one question at a time) and then enter the answers for a student (one question at a time). The program should then check each question to see if the student answered each question correctly. Finally, the program should output the e x a m score. Let us assume that each question is worth the same amount.
To enter the solutions and the answers, we will create a function that has two output parameters. To grade the e x a m, we will create another function that has two input parameters. The function prototypes are given below:
void get_exam_data(char solutions[], char answers[]);
void grade(char solutions[], char answers[]);
get_exam_data should ask the user to enter the solution for each question on the e x a m. The function should then ask the user to enter the students answer to each question. for loops are highly recommended. To prevent issues with scanf, I recommend using flushall() after each call to scanf. For simplicity purposes, we will assume that the user will enter a character between a and e.
grade will actually grade the e x a m. For each question, compare the solution to the students answer. The function needs to keep track of the number of correct answers in order to grade the e x a m. After comparing all of the answers with the solutions, the function should display the grade as a percent. For example, if a student got 4 of the 5 questions correct, the score is 80.00%. Note, to print an actual %, use %%.
An example of the output is given below:
Enter the solution to Question 1: a
Enter the solution to Question 2: b
Enter the solution to Question 3: c
Enter the solution to Question 4: d
Enter the solution to Question 5: e
Enter the students answer to Question 1: a
Enter the students answer to Question 2: b
3
Enter the students answer to Question 3: d
Enter the students answer to Question 4: c
Enter the students answer to Question 5: e
Question 1 is correct.
Question 2 is correct.
Question 3 is incorrect.
Question 4 is incorrect.
Question 5 is correct.
Your score is 3/5 or 60.00%.
***C++, NOT C CODE***
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
