Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

C program to evaluate responses to a multiple-choice test

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to evaluate responses to a multiple-choice test in C Programming with practical program code and step-by-step full complete explanation.

C program to evaluate responses to a multiple-choice test

C Program to evaluate responses to a multiple-choice test.

 
#include<stdio.h>
#include<conio.h>

#define STUDENTS 3
#define ITEMS 25

void main()
{
    char key[ITEMS+1], response[ITEMS+1];
    int count, i, student, n, correct[ITEMS+1];

    printf("Input key to the items");

    for(i=0;i<ITEMS;i++)
    {
        scanf("%c", &key[i]);
        scanf("%c", &key[i]);
    }

    key[i]='';

    for(student=1; student<=STUDENTS; student++)
    {
        count=0;
        printf("n");
        printf("Input responses of student - %d",student);

        for(i=0;i<ITEMS;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;
                count[i]=1;
            }
        }

        printf("n");
        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("n");

    }
}

Output

 
Input key to the items
abcdabcdabcdabcdabcdabcda

Input responses of student-1
abcdabcdabcdabcdabcdabcda

student-1
score is 25 out of 25
response to the following items are wrong
NIL

Input responses of student-2
abcddcbaabcdabcdddddddddd

student-2
score is 14 out of 25
Response to the following items are wrong
5 6 7 8 17 18 19 21 22 23 25

Input responses of student-3
aaaaaaaaaaaaaaaaaaaaaaaaa

student-3
score is 7 out of 25
Response to the following items are wrong
2 3 4 6 7 8 10 11 12 14 15 16 18 19 20 22 23 24
c coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes