Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to grade an n-question multiple-choice exam (for n between 5 and

ID: 3640274 • Letter: W

Question

Write a program to grade an n-question multiple-choice exam (for n between 5 and 50). Your program will take data from the standard input. The first line of the input contains the number of questions M, followed by a list of characters that specifies the letters of the correct answers. The second line contains the number of students N. Each of the next N lines contains a student id number followed by M characters that specify the student's answers for each of the questions.
Your program should print N lines, each of which contains the student's score as a percentage of the total number of questions.
Remarks: Please replicate the exact text of the prompts and the output. Even though the text must be the same, the numbers may be different depending on the user input. When printing the question numbers and student ids, use a cell of size 3 (i.e, "%3d" in printf()). When printing the score, please round it to a percent, reserving three characters for the cell (i.e., use %3.0f in printf).
============= START OF SAMPLE RUN =======================
---------------- START OF INPUT -------------------------
5 dbbac
3
111 dabac
102 dcbdc
251 dbbac
----------------- END OF INPUT --------------------------
---------------- START OF OUTPUT ------------------------
Exam Report
Question 1 2 3 4 5
Answer d b b a c
ID Score(%)
111 80
102 60
251 100
----------------- END OF OUTPUT -------------------------
============= END OF SAMPLE RUN =======================

Explanation / Answer

please rate - thanks

#include <stdio.h>
#include <conio.h>
int main()
{char key[50];
char ans[50][50],f;
int id[50];
int i,j,m,n,count;
double average;
printf("============= START OF SAMPLE RUN ======================= ");
printf("---------------- START OF INPUT ------------------------- ");
scanf("%d",&m);
scanf("%c",&f );
for(i=0;i<m;i++)
    { scanf("%c",&key[i]);
    }
scanf("%d",&n);
for(i=0;i<n;i++)
    {scanf("%d",&id[i]);
    scanf("%c",&f );
    for(j=0;j<m;j++)
         {scanf("%c",&ans[i][j]);
         }
    }
printf("----------------- END OF INPUT -------------------------- ");
printf("---------------- START OF OUTPUT ------------------------ ");
printf("Exam Report ");
printf("Question");
for(i=0;i<m;i++)
     printf("%3d",i+1);
printf(" ");
printf("Answer ");    
for(i=0;i<m;i++)
     printf("%3c",key[i]);
printf(" ");    
printf("ID   Score(%%) ");
for(i=0;i<n;i++)
    {count=0;
    printf("%3d ",id[i]);
    for(j=0;j<m;j++)
         if(ans[i][j]==key[j])
               count++;
    average=(double)count/m*100;
     printf("%3.0f ",average);
    }
printf("----------------- END OF OUTPUT ------------------------- ");
printf("============= END OF SAMPLE RUN ======================= ");
getch();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote