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
What is the difference between software hardware ???
defon
Software are parts of a computer system that can be seen but not touched.

Hardware are parts of a computer system that can be seen and touched
3 0
3 years ago
Read 2 more answers
If we have the following array/list:
oee [108]

Answer:

The correct answer is A) "red"

Explanation:

Using arrays and lists are very helpful when writing programs. They help simplify programs by storing <u>related data</u> under one name.

In the question above the general name is <u>myList</u>. <em>The related data are red, orange, yellow, green, blue, indigo, and violet.</em>

This means that myList contains values a,b,c,d,e,f, and g. However myList[1] only contains value "red".

Cheers!

4 0
3 years ago
Read 2 more answers
Please HELP me it a test and it due rn. Please no links
kirill115 [55]

Answer:

okay

Explanation:

wats the test about ?

send the topics to help you revise the content

7 0
3 years ago
The ____ causes the network to settle into a stable state where it can correctly respond, to any desired degree of accuracy, to
Tema [17]

Answer:

The back propagation algorithm causes the network to settle into a stable state where it can correctly respond, to any desired degree of accuracy, to all inputs in the training set.

Explanation:

Back propagation algorithm is a part of the learning of a neural network. In a simple neural network setting at each iteration;

  • The network<em> </em>assumes <em>random weights</em>  at each network layer and passes the value to the next trough an <em>activation function</em>.
  • Then a loss function is calculated by comparing the distace of the final value with the label value using a predetermined distance metric.
  • The weights are optimized trough back propagation

Thus, back propagation algorithm used to reach the final weights of the neural network, so that it can work more accurately.

3 0
4 years ago
Lab Goal : This lab was designed to demonstrate the similarities and differences in a for loop and a while loop.Lab Description
Mandarinka [93]

Answer:

See Explanation

Explanation:

Required:

Use for and while loop for the same program

<u>(1) String Cleaner</u>

#For Loop

name = "I am Sam"

result = ""  

<em>for i in range(0, len(name)):  </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

print(result)

#While Loop

name = "I am Sam"

result = ""  

<em>i = 0 </em>

<em>while i < len(name): </em>

<em>    if name[i]!= 'a':  </em>

<em>        result = result + name[i] </em>

<em>    i+=1 </em>

print(result)

<u>(2): Common Divisor</u>

#For Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

<em>for i in range(2,div):</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

print()

#While Loop

num1 = 528

num2 = 60

div = num2

if num1 > num2:

   div = num1

i = 2

<em>while i <div:</em>

<em>    if num1%i == 0 and num2%i==0:</em>

<em>        print(i,end = " ")</em>

   i+=1

The iterates statements show the difference in the usage of both loops.

For the for loop, the syntax is:

<em>for [iterating-variable] in range(begin,end-1)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

<em />

For the while loop, the syntax is:

<em>while(condition)</em>

<em>-------</em>

<em>---</em>

<em>--</em>

8 0
3 years ago
Other questions:
  • Why can’t web apps send notifications to a device’s taskbar when the app is closed?
    12·1 answer
  • You often insert your company's logo into documents you create. One way to make it easier for you to quickly insert it is to sav
    12·1 answer
  • The actual database of Active Directory shared resources is stored on one or more computers designated as:
    10·1 answer
  • What is displayed in the alert dialog box after the following code is executed? var scores = [70, 20, 35, 15]; scores[scores.len
    8·1 answer
  • ​Kendra is taking a class in Finance and she has been asked to give a speech about a case study in which she's been working. She
    10·1 answer
  • Do you see traffic flowing from the internet into your system or from your network to the internet? explain why or why not:
    6·1 answer
  • 8.10 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's a
    12·1 answer
  • Though there are no specific federal laws for cyberbullying, in some cases cyberbullying
    6·1 answer
  • Write a program that contains three methods:
    7·1 answer
  • Difine Mainframe Computer~<br><br><br><br><br><br><br><img src="https://tex.z-dn.net/?f=%20%5C%3A%20%20%5C%3A%20" id="TexFormula
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!