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
someone please tell me if you watch drag race (rupauls drag race) I need someone to talk to about it ​
lys-0071 [83]
I’m gonna watch it soon
3 0
3 years ago
Which of the following statements is false? Data is lost when a local variable "goes out of scope." Data maintained in files is
Veronika [31]

Answer:

The false statement is "Data maintained in files is often called transient data".

Explanation:

In computer programming, transient data is a temporary storage to hold the value which is created within an application session. The transient data will be discarded at the end of the program. The transient data will be reset to its default value when running the program again.  In contrast, file is known as a persistent storage which will still hold data even after end of a program. This is the reason the statement "Data maintained in files is often called transient data" is contradictory and therefore is considered a false statement.

5 0
3 years ago
The greater the profit motive in an economic system , the greater the likelihood of a.Innovation b.Equity c.Security d.Governmen
xxMikexx [17]

Answer:

d. Government controlling the factors of production.

Explanation:

Businesses exist to make profit. There is requirement to provide value for money to the customers in order for a business to achieve success. When a business fails to provide good customer service and exists only to make profits they might fail. In such situation government intervenes to stop the monopoly and save the consumers from the mercy of business.

3 0
3 years ago
______ have become a common and easily created form of malware that are creating using applications such as Visual Basic or VBSc
Helen [10]

Answer:

Macro Viruses

Explanation:

Macro Viruses have become a common and easily created form of malware that are creating using applications such as Visual Basic or VBScript.

7 0
3 years ago
Which of the following data structures can erase from its beginning or its end in O(1) time?
11111nata11111 [884]

Where all "the following" i can help you but you said which of the folllowing and ther no picture or anything?

8 0
3 years ago
Other questions:
  • How do you adjust the shear of a shape?
    10·2 answers
  • Alice is working on a web page to attract the maximum number of people to join her cause. She wants to inform people about the b
    10·2 answers
  • Create a program asks a user for an odd positive integer. If the user gives and even number or a number that is negative it prom
    7·1 answer
  • What term is given to pieces of computer software that allow you to manage your e-mail from your computer?
    12·1 answer
  • In modern web design, color, font, font size, and style should be declared using:
    5·1 answer
  • Which of the following statements is false? The ARPANET is the precursor to today’s Internet. Today’s fastest Internet speeds ar
    11·1 answer
  • The automatic number of worksheets that appear when you open a blank Excel workbook is ? 1.One 2.Three 3.Six 4.Ten
    8·1 answer
  • How do I do this? I know the shapes and everything but how do I do b, d, and e?
    7·1 answer
  • A horse is how much percent more powerful than a pony
    11·1 answer
  • The temperature at 8 AM was 44°F and at noon it was 64°F. what was the percent of change from 8 AM to noon?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!