Question

Objective: write a program that grades multiple-choice test ¡ Each question counts 1 credit. Disp...

Objective: write a program that grades multiple-choice test
¡ Each question counts 1 credit. Display the final score for each student.

Students’ answer

0

1

2

3

4

5

Student 0

A

B

A

C

C

D

Student 1

d

B

A

B

C

A

Student 2

e

D

d

A

C

B

Student 3

C

B

A

E

D

C

Key to the Questions

0

1

2

3

4

5

Key

D

B

D

C

C

D

¡ Here is a sample run:

Student 0’s credit is 4

Student 1’s credit is 3

Student 2’s credit is 2

Student 3’s credit is 1

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code in c++:-

#include<bits/stdc++.h>
using namespace std;
struct student{
   char choice[6];
};
int credits(student &students, char b[])
{
   int credit=0;
   for(int i=0;i<6;i++) {
       if(students.choice[i]==b[i]) credit++;
   }
//   cout<<"credit of "<<char(&students)<<"'s credit is "<<credit<<endl;
return credit;
}
void upper(student &students)
{
   for(int i=0;i<6;i++) students.choice[i]=toupper(students.choice[i]);
}
int main()
{
   char a[6];
   strcpy(a,"DBDCCD");
struct   student student0,student1,student2,student3;
   strcpy(   student0.choice, "ABACCD");
   strcpy(   student1.choice, "dBABCA");
   strcpy(   student2.choice, "eDdACB");
   strcpy(   student3.choice, "CBAEDC");
   upper(student0);
   upper(student1);
   upper(student2);
   upper(student3);
   cout<<"Student0"<<"'s credit is "<<credits(student0,a)<<endl;
   cout<<"Student1"<<"'s credit is "<<credits(student1,a)<<endl;
   cout<<"Student2"<<"'s credit is "<<credits(student2,a)<<endl;
   cout<<"Student3"<<"'s credit is "<<credits(student3,a)<<endl;
   return 0;
}

2.cpp 1 #include<bits/stdc++.h> 2 using namespace std; 3 struct student( 4 char choice[6]; 6 int credits(student &students, c

2.cpp 12/ // Coutくくcredit of <<char(8students)<<s 13 return credit; 14 15void upper(student &students) 16 17 18 19 int ma

Output is:-

2.cpp 12 /cout<<credit of <char(&students)<< s credit is <<credit<<endl; 13 returncredit 14 15 void upper(student &studen

CAUsers\Lenovo\Documents\2.exe Student1s credit is 3 Student2s credit is 2 Student3s credit is 1 Process exited after 0.02

I just used a simple method to get the desired output,

the above problem can be done by using classes too.

if you need any changes in the code or else if you have any preferences in the coding part such as java language or using classes, etc....

Please feel free to comment

Add a comment
Know the answer?
Add Answer to:
Objective: write a program that grades multiple-choice test ¡ Each question counts 1 credit. Disp...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You have been asked to write a program to grade several multiple-choice exams. The exam has...

    You have been asked to write a program to grade several multiple-choice exams. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’. The answers key is declared in the program as constant of type string. An example of answer key is “abcdefabcdefabcdefab”. Your program should work for any other answer key. The program should first ask users for the number of students to be graded. Then it should have a while loop...

  • SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes...

    SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array....

  • In this assignment you are asked to write a python program to maintain the Student enrollment...

    In this assignment you are asked to write a python program to maintain the Student enrollment in to a class and points scored by him in a class. You need to do it by using a List of Tuples What you need to do? 1. You need to repeatedly display this menu to the user 1. Enroll into Class 2. Drop from Class 3. Calculate average of grades for a course 4. View all Students 5. Exit 2. Ask the...

  • Java: The local Driver's License Office has asked you to write a program that grades the...

    Java: The local Driver's License Office has asked you to write a program that grades the written portion of the driver's   license exam. The exam has 20 multiple choice questions.   Here are the correct answers:    1. B  6. A  11.B  16. C    2. D  7. B  12.C  17. C    3. A   8. A  13.D  18. B    4. A  9. C  14.A  19. D    5. C  10. D  15.D  20. A    Your program should store the correct answers in an array. (Store each question's answer in an element of a String array.) The program...

  •   -You are going to write a program to help me determine the final grade and...

      -You are going to write a program to help me determine the final grade and calculate some summary stats. The steps are described below: 1. First, create a dictionary of 10 students with student name as key and score as value. •For simplicity, name students as student 1, student 2, etc. Scores are random integers from 0-100 2. Calculate the average score in the class 3. Determine the letter grade based on the following scheme :•A if score >=...

  • please use the c language Assignment 12 The program to write in this assignment is a...

    please use the c language Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...

  • codeblock c++ language Write a program that reads students test scores in the range 0-200 from...

    codeblock c++ language Write a program that reads students test scores in the range 0-200 from a file until end of file (use e of() to check if ifstream reaches the End of File Stream) and store those scores in an array. It should then determine the number of students having scores in each of the following ranges: 0-24, 25-49, 50-74, 75-99, 100- 124, 125–149, 150-174, and 175–200. Finally, the program outputs the total number of students, each score range...

  • In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

    In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...

  • using C# Write a program which calculates student grades for multiple assignments as well as the...

    using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...

  • in C porgraming . use #include〈stdio.h〉 #include〈stdlib.h〉 Assignment 12 The program to write in this assignment...

    in C porgraming . use #include〈stdio.h〉 #include〈stdlib.h〉 Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and scores are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 2011710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student_id,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT