Answered step by step
Verified Expert Solution
Question
1 Approved Answer
nd he ng ght OW 12 13 14 15 16 LISTING Grade Exam.java 1 public class GradeExam { 2 /** Main method */ 17
nd he ng ght OW 12 13 14 15 16 LISTING Grade Exam.java 1 public class GradeExam { 2 /** Main method */ 17 PEZZELNE 285 Key DBD CCDAEAD Your program grades the test and displays the result. It compares each student's answers with the key, counts the number of correct answers, and displays it. Listing 8.2 gives the program. gribnitybus2 sas) 0.8 3 public static void main(String[] args) { // Students' answers to the questions char[] [] answers = { 4 5 6 7 8 9 10 11 18 19 20 22 23 24 25 Student O Student 1 Student 2 Student 3 Student 4 Student 5 Student 6 Student 7 The key is stored in a one-dimensional array: husqaroo 27 29 Students' Answers to the Questions: 0 1 2 3 4 5 6 7 8 9 //. 8.5 Case Study: Grading a Multiple-Choice Test 297 ABACCDEEAD DBABCAEEAD EDDACBEEAD CBAEDCEEAD ABD CCDEEAD BBECCDEEAD BBACCDEEAD EBECCDEEAD Key to the Questions: 0123456789 } {'A', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}, {'D', 'B', 'A', 'B', 'C', 'A', 'E', 'E', 'A', 'D'}, {'E', 'D', 'D', 'A', 'C', 'B', 'E', 'E', 'A', 'D'}, {'C', 'B', 'A', 'E', 'D', 'C', 'E', 'E', 'A', 'D'}, {'A', 'B', 'D', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}, {'B', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}, {'B', 'B', 'A', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}, {'E', 'B', 'E', 'C', 'C', 'D', 'E', 'E', 'A', 'D'}}; // Grade all answers for (int i = 0; i < answers.length; i++) { // Grade one student int correct Count = 0; for (int j = 0; j < answers [i].length; j++) { if keys [j]) (answers[i][j] correct Count++; correctCount); // Key to the questions char[] keys = {'D', 'B', 'D', 'C', 'C, 'D', 'A', 'E', 'A', 'D'}; to englis System.out.println("Student " + i + "'s correct count is " + S 2-D array 1-D array 24-1201 compare with key er 8 Multidimensional Arrays $260 28 Student O's correct count is 7 Student 1's correct count is 6 Student 2's correct count is 5 Student 3's correct count is 4 Student 4's correct count is 8 Student 5's correct count is 7 Student 6's correct count is 7 Student 7's correct count is 7 Check Point of The statement in lines 5-13 declares, creates, and initializes a two-dimensional array characters and assigns the reference to answers of the char [] [] type. The statement in line 16 declares, creates, and initializes an array of char values and assigns the reference to keys of the char[] type. Each row in the array answers stores a student's answer, which is graded by comparing it with the key in the array keys. The result is displayed immediately after a student's answer is graded. 8.5.1 How do you modify the code so it also displays the highest count and the student with the highest count? 8.6 Case Study: Finding the Closest Pair This section presents a geometric problem for finding the closest pair of points. Key Point choice test 8.5 Case Study: Grading a Multiple-Choice Test The problem is to write a program that will grade multiple-choice tests. pne Suppose you need to write a program that grades multiple-choice tests. Assume there are eight students and ten questions, and the answers are stored in a two-dimensional array. Each row records a student's answers to the questions, as shown in the following array: 2222 23 24 25 26 27 2235 28 29 30 31
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The given program is designed to grade a multiplechoice test It compares each students answers with ...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