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
Maslowich
3 years ago
12

Write a program that grades arithmetic quizzes as follows: Ask the user how many questions are in the quiz. Ask the user to ente

r the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. You will need to store the key in an array. Ask the user to enter the answers for the quiz to be graded. As for the key, these can be entered on a single line. Again there needs to be one for each question. Note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. When the user has entered all of the answers to be graded, print the number correct and the percent correct.
Computers and Technology
1 answer:
kirill115 [55]3 years ago
7 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int questions, answer;

   cout<<"Questions: ";

   cin>>questions;

   int answerkey[questions];

   cout<<"Enter answer keys: ";

   for(int i = 0; i< questions; i++){

       cin>>answerkey[i];    }

   int correct = 0;

   cout<<"Enter answers: ";

   for(int i = 0; i< questions; i++){

       cin>>answer;

       if(answer == answerkey[i]){

           correct++;        }    }

   cout<<"Correct answers: "<<correct<<endl;

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

   return 0;

}

Explanation:

This declares the number of questions and the answers submitted to each equation

   int questions, answer;

Prompt to get the number of questions

   cout<<"Questions: ";

This gets input for the number of questions

   cin>>questions;

This declares the answerkey as an array

   int answerkey[questions];

Prompt to get the answer key

   cout<<"Enter answer keys: ";

This iteration gets the answer key for each question

<em>    for(int i = 0; i< questions; i++){</em>

<em>        cin>>answerkey[i];    }</em>

This initializes the number of correct answers to 0

   int correct = 0;

Prompt to get the enter the answers

   cout<<"Enter answers: ";

This iterates through the answer keys

   for(int i = 0; i< questions; i++){

This gets the answer to each question

       cin>>answer;

This compares the answer to the answer key of the question

       if(answer == answerkey[i]){

If they are the same, correct is incremented by 1

           correct++;        }    }

Print the number of correct answers

   cout<<"Correct answers: "<<correct<<endl;

Print the percentage of correct answers

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

You might be interested in
A team member was assigned 4 stories during sprint planning for a 2 week Sprint. Story 1 is easy to complete but does not add a
lbvjy [14]

Answer:

Option (B) is correct answer.

Explanation:

In this whole world, any person needs to do the task because of some profits. If there is a task with more points and if it is easy then it needs to be executed first.

Here in this question, story 2 is an easy task and gives more money, so that is to be executed first. Story 4 also gives more money but it is not easy so no one grantee to complete the task.

Hence option b is the correct answer. while the other option is not because--

  • Option "a" states about story 1, which is easy to complete but can not provide any type of value or money. So why anyone complete that task first which does not gives any types of profits.
  • Option c states about story 3, which is not easy to complete and also does not give any profits. So do not need to complete that task first which does not provide any profits and also that is difficult.
  • Option d states about story 4, which is not easy to complete but gives a lot of points. But there is no grantee that the task can complete in time. so no one needs to complete the risky task in the first order.

Hence the team member needs to execute the task in the following order--

  1. Story 2
  2. Story 4
  3. Story 1 and then
  4. Story 3

4 0
3 years ago
Object-oriented programming allows you to derive new classes from existing classes. This is called
Umnica [9.8K]

Answer: Inheritance

Explanation: Inheritance is the feature that is displayed by the class where it happens to acquire the properties of the other classes and exhibit it. the inheriting nature of the class is seen in two different categories -superclass and subclass. It is a concept that is usually followed in the object -oriented programming. The reason for the inheritance is to reuse the element and their properties of other class.

8 0
3 years ago
Does windows 7 has vb6stkit.dll in system 32
vfiekz [6]
Yes! If you want a more in depth answer then look at http://www.processlibrary.com/en/directory/files/vb6stkit/21517/ | Hope I helped and have a nice day!
5 0
3 years ago
Write a program that accepts a time as an hour and minute. Add 15 minutes to the time
Anastaziya [24]

Answer:

The code is given below

hours = int(input("Enter time in hour: "))

minutes = int(input("Enter time in minute: "))

total time = (hours * 60) + (minutes + 15 )

total hours = int(total minutes  / 60)

minutes  = total hours/ 60

print("Hours: " + str(hours))

print("Minutes: " + str(minutes))

5 0
3 years ago
What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is
erica [24]

Answer:

It counts the number of items in the given list that are less than Description temp:

Explanation:

Following are the description of the loop  

  • In the given question initially, the value of "j" variable is initialized to 0.
  • After that loop will iterate less then the length of the list array.
  • The  if(list[j] < temp) checks the condition if it is true then c++ increment the value by 1  
  • j++ increment the value of "j" by 1.

4 0
4 years ago
Other questions:
  • What medium allows for electronic delivery of DTP content without the need for any physical media?
    13·1 answer
  • Someone who wants the credentials of skilled training, but in less time than a four-year degree should consider
    11·1 answer
  • What feature of excel allows you to automatically calculate common formulas which select data
    9·1 answer
  • Jack is going for a safari. Which camera should he take with him and why?
    6·1 answer
  • Henry is planning to visit Spain for a vacation. He wants to learn Spanish, but he prefers to do it in a fun way. He searches on
    8·2 answers
  • If an engineer wants to verify changes that she has been making on a router, which commands will allow her to check the routers
    15·1 answer
  • Excel files have a default extension of ?
    12·1 answer
  • What does the computer receive when you press a key on a laptop keyboard?
    8·1 answer
  • Give an explanation of one network connection (it will every helpful​
    13·1 answer
  • To track what level a player is on, you can create a simple variable and a block saying change level by 1 attached to the when g
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!