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
Lostsunrise [7]
2 years ago
7

Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false q

uestions. Each correct answer is worth 2 points.
Computers and Technology
1 answer:
Eddi Din [679]2 years ago
7 0

The quiz program is an illustration of loops and conditional statements

  • Loops are used to perform repetition
  • Conditional statements are used to make decisions

<h3>The quiz program</h3>

The quiz program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

int main(){

   //This prints the instruction

   cout<<"Enter T/t for True; F/f for False\n";

   //This initializes the question

   string questions[5] = { "Q1", "Q2", "Q3", "Q4", "Q5"};

   //This initializes the correct options

   char options[5] = { 'T','T','F','F','T'};

   //This declares the user response

   char opt;

   //This initializes the score to 0

   int score = 0;

   //This loop is repeated 5 times

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

       //This prints the current question

       cout << i + 1 <<". "<<questions[i]<<"\nAnswer: ";

       //This gets the user response

       cin>>opt;

       //If the user response is correct

       if(toupper(opt) == options[i]){

           //The score is incremented by 2

           score+=2;

       }

   }

   //This prints the total score

   cout<<"Score: "<<score;

   return 0;

}

Read more about loops at:

brainly.com/question/19347842

You might be interested in
Implement a function inValues() that asks the user to input a set of nonzero floating-point values. When the user enters a value
elena-s [515]

Answer:

Explanation:

The following is written in Python and uses exception handling to do exactly as requested. It then goes adding all of the integer values to an array called num_list and finally adding them all together when the function ends.

def in_values():

   num_list = []

   while True:

       try:

           num = input("Input non-zero floating point: ")

           num = int(num)

           if num == 0:

               break

           else:

               num_list.append(num)

       except ValueError:

           print("No valid integer! Please try again ...")

           try:

               num = input("Input non-zero floating point: ")

               num = int(num)

               break

           except ValueError:

               break

   sum = 0

   for number in num_list:

       sum += number

   return sum

5 0
3 years ago
What would be the result after the following code is executed? final int SIZE = 25; int[] array1 = new int[SIZE]; // Code that w
Maurinko [17]

Answer:

The "Value" variable contains the lowest value of array1 list.

Explanation:

  • When the user passes the value on the array, then the above code is used to find the minimum value from the list of value which is passed by the user.
  • The above array has the 25 sizes, so it will take only 25 value from the user, Then the loop will assume the first value as the minimum value and assign that value on the variable "value".
  • Then all the other elements accessed by the for loop and compare with the value of Value variable if the array value is minimum, then that value is assigned on the variable value.
  • Hence the minimum value of the list will be assigned on the variable value.
8 0
3 years ago
Which ipsec component is software that handles the tasks of encrypting, authenticating, decrypting, and checking packets?
ad-work [718]
The ipsec component software that handles the tasks of encrypting, authenticating, decrypting, and checking packets is called IKE.  It is short for Internet Key Exchange.  It is <span>a network security Protocol aimed to allow two devices to actively exchange Encryption Keys and negotiate Security Associations </span>
8 0
3 years ago
Which answer best describes an unsubsidized federal loan? AYou are only responsible for the cost of the loan. BThe federal gover
Goshia [24]
They are loans that accrue interest over time and the person who has taken out the unsubsidized loan (generally students) are in charge of the interest that has been accrued over the years. 

<span>When I was a student, my mom always told me to only use the subsidized loans if possible, because interest doesn't accrue on those loans while you are in school, and depending on the loan itself, you don't have to pay them back.</span>
5 0
4 years ago
In 2019, the tuition for a full time student is $7,180 per semester. The tuition will be going up for the next 7 years at a rate
Morgarella [4.7K]

Answer:

In Python:

tuition = 7180

year = 2019

rate = 0.035

for i in range(2019,2027):

   print(str(year)+": "+str(round(tuition,2)))

   tuition = tuition * (1 + rate)

   year = year + 1

   

Explanation:

This initializes the tuition to 7180

tuition = 7180

This initializes the year to 2019

year = 2019

This initializes the rate to 3.5%

rate = 0.035

This iterates through years 2019 to 2026

for i in range(2019,2027):

This prints the year and tuition

   print(str(year)+": "+str(round(tuition,2)))

This calculates the tuition

   tuition = tuition * (1 + rate)

This increments year by 1

   year = year + 1

3 0
3 years ago
Other questions:
  • Why are computer programs so much longer now than they were in the late 1980?
    8·1 answer
  • Which of the following is applicable during a hostile act:
    15·1 answer
  • What kind of firewall can block designated types of traffic based on application data contained within packets?
    7·1 answer
  • To add a new kind of information into the database you need to add a new table<br> true or false?
    7·2 answers
  • Define a lambda function that accepts one argument (a list of strings) and returns a list of only the words that start with an '
    9·1 answer
  • 13. A 2-sided coin has an equal likelihood of landing on each side. One side is called "heads" and the other is called "tails".
    11·1 answer
  • Given the following statement, what is the value of myExample?
    13·1 answer
  • 1. Separate valid and invalid variables:
    9·1 answer
  • William brought some data into his Tableau Book, but the data had some null values and incorrect column headers. What did Willia
    15·1 answer
  • Your friend Cameron’s little sister is visually impaired. Cameron is worried that his sister will not be able to use technology
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!