1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
a_sh-v [17]
3 years ago
8

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: B 2.D 3.A 4.A 5.C 6.A 7.B 8.A 9.C 10.D 11.B 12.C 13.D 14.A 15.D 16.C 17.C 18.B 19.D 20.A Your program should store the correct answers shown above in an array. It should ask the user to enter the student’s answers for each of the 20 questions, and the answers should be stored in another array. After the student’s answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions. in C++
Computers and Technology
1 answer:
Zepler [3.9K]3 years ago
7 0

Answer: The c++ program is shown below.

#include <iostream>

using namespace std;

int main() {

   int ques[20], correct=0, incorrect=0, q[20];

// arrays to store answers for the questions

   char a[20], ans[20];

// variable to store pass or fail result

   string result;    

   for(int k=0; k<20; k++)

   {

       ques[k] = k+1;

       q[k] = 0;

   }    

   ans[0]='B';

   ans[1]='D';

   ans[2]='A';

   ans[3]='A';

   ans[4]='C';

   ans[5]='A';

   ans[6]='B';

   ans[7]='A';

   ans[8]='C';

   ans[9]='D';

   ans[10]='B';

   ans[11]='C';

   ans[12]='D';

   ans[13]='A';

   ans[14]='D';

   ans[15]='C';

   ans[16]='C';

   ans[17]='B';

   ans[18]='D';

   ans[19]='A';    

   for(int k=0; k<20; k++)

   {

       cout<<"Enter the ans for question "<<k+1<<endl;

       cin>>a[k];

   }    

   for(int k=0; k<20; k++)

   {

       if(a[k] == ans[k])

           correct++;

       else

       {

           incorrect++;

           q[k] = k+1;

       }

   }    

   if(correct >= 15)

       result = "passed";

   else if(incorrect >= 5)

       result = "failed";

       

   cout<<endl<<"You have "<<result<<" in the exam."<<endl;

   cout<<"Correctly answered questions "<<correct<<endl;

   cout<<"Incorrectly answered questions "<<incorrect<<endl;

   cout<<"Incorect questions are "<<endl;

   cout<<"\t";

   for(int k=0; k<20; k++)

   {

// 0 indicates correct question

       if(q[k] == 0)

           continue;

       else

           cout<<k+1<<"\t";

   }    

}

 

OUTPUT

Enter the ans for question 1

A

Enter the ans for question 2

A

Enter the ans for question 3

A

Enter the ans for question 4

A

Enter the ans for question 5

A

Enter the ans for question 6

A

Enter the ans for question 7

A

Enter the ans for question 8

A

Enter the ans for question 9

A

Enter the ans for question 10

A

Enter the ans for question 11

A

Enter the ans for question 12

A

Enter the ans for question 13

A

Enter the ans for question 14

A

Enter the ans for question 15

A

Enter the ans for question 16

D

Enter the ans for question 17

D

Enter the ans for question 18

D

Enter the ans for question 19

D

Enter the ans for question 20

D

You have failed in the exam.

Correctly answered questions 6

Incorrectly answered questions 14

Incorect questions are  

1 2 5 7 9 10 11 12 13 15 16 17 18 20  

NOTE:

The answers are stored in upper case. This program may not accept answers in lower case.

You might be interested in
Which factors effect a population growth regardless of population size?
pshichka [43]

Disease, disease will dwindle a population.

Government, depending how the government operates, it could easily drive people out of it.

-TheOneandOnly003

4 0
4 years ago
URGENT PLEASE HELP!!!!!
Allisa [31]

Answer:

in my opinion I choose the rule of simplification

7 0
3 years ago
5 características de la obsolescencia programada...
snow_lady [41]

Answer:

Obsolescencia programada es cuando un producto está diseñado deliberadamente para tener un tiempo de vida específico. ... Los productos dejan de funcionar al cabo de un tiempo, no porque estén estropeados, sino por que han sido diseñados para fallar al cabo de ese periodo.

Explanation:

espero y esto te pueda ayudar

4 0
3 years ago
Which method deletes a footer from a document?
Charra [1.4K]
The first option is your answer DOUBLE CLICK THE FOOTER REGION ECT
8 0
3 years ago
30 POINTS
avanturin [10]

Answer:

i- why is there so many words!!!

4 0
3 years ago
Other questions:
  • 5.William travels a lot on business purpose. He needs to regularly communicate with his business partner. He also needs to send
    15·1 answer
  • What type of electronic monitoring involves an offender being contacted periodically by telephone or beeper to verify his or her
    5·1 answer
  • What is an input periphal
    8·2 answers
  • A cell has an unlimited number of conditions for Conditional Formatting.<br> A.true<br> B.false
    7·1 answer
  • A robot can complete 7 tasks in hour. Each task takes the same amount of time.
    15·2 answers
  • A celebrity blogger you have followed for years advises readers to try a new beauty product. Before purchasing the product, a sa
    10·1 answer
  • Write a script called fact.sh that is located in your workspace directory to calculate the factorial of a number n; where n is a
    14·1 answer
  • Program a substitution cipher in Python. Create 2 functions one for encryption and the other for decryption ( get the text as th
    8·1 answer
  • HELPPPPP Which tag used to add a new line:<br> A. ol<br> B. P<br> C. h1<br> D li
    7·1 answer
  • Which statement best describes one reason why assembly language is easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!