Question

In: Computer Science

Who knows how to do pseudocode on this topic? The local driver's license office has asked...

Who knows how to do pseudocode on this topic?
The local driver's license office has asked you to design 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:

1. 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 these correct answers in an list. (Store each question's correct answer in an element of a String list). The program should ask the user to enter the student's answers for each questions, which should be stored in another list. 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). The program should also 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.

Notes:

1. pseducode program

2. Your program needs three lists: the first list holds the correct answers, the second list holds the student's answers, and the third list holds the question numbers for those questions that are not answered correctly.

3. Input validation is required for student's answers: when the input is not A, B, C, or D, your program needs to display an error message and get another input. The input validation is done using a while loop.

4. After getting the student's answers, the program will compare the two lists. If a question is answered wrong, the question number of that question will be put into the third list

Solutions

Expert Solution

#include <iostream>

using namespace std;

int main()
{
    int i=0,c=0,k=0;
    int arr[20];//list which will show incorrect answers
   char str1[]={'B','D','A','A','C','A','B','A','C','D','B','C','D','A','D','C','C','B','D','A'};//the correct list
   char str2[20];//the list of student answers
   cin>>str2;
   //validating input
   while(i<20){
       if((str2[i]!='A')&&(str2[i]!='B')&&(str2[i]!='C')&&(str2[i]!='D')){
           cout<<"input error at"<<i+1<<"try again";
           cin>> str2[i];
       }
       i++;
       
       }
       //comparing the answers
   for(i=0;i<20;i++){
       if(str1[i]!=str2[i]){
           c++;
           arr[k]=i+1;
           k++;
       }
       
   }
   if(c>5){
      cout<<"Student failed the exam\n"; 
   }
   else{
      cout<<"Student passed the exam\n"; 
   }
   cout<<"The number of correctly answered questions are"<<20-c<<"\n";
   cout<<"The number of incorrectly answered questions are"<<c<<"\n";
   if(c!=0){
   cout<<"list showing number of the incorrectly answered questions\n";
   //prints the list of incorrect answered questions
   for(i=0;i<k;i++){
       cout<<arr[i]<<"\n";
   }
   }
   return 0;
}

Sample output:


Related Solutions

The local driver's license office has asked you to design a program that grades the written...
The local driver's license office has asked you to design 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 D A A C A B A C D B C D A D C C B D A Your program should store these correct answers in an list. (Store each question's correct answer in an element of a String list). The program should ask...
The local driver's license office has asked you to design a program that grades the written...
The local driver's license office has asked you to design a program that grades the written portion of the driver's license test. The test has 20 multiple choice questions. Here are the correct answers: B D A A C A B A C D B C D A D C C B D A Your program should store these correct answers in an list. (Store each question's correct answer in an element of a String list). The program should ask...
You have to get a new driver's license and you show up at the office at...
You have to get a new driver's license and you show up at the office at the same time as 4 other people. The office says that they will see everyone in alphabetical order and it takes 20 minutes for them to process each new license. All of the agents are available now, and they can each see one customer at a time. How long will it take for you to walk out of the office with your new license?...
Who knows to do this topic with python code? Write a program to perform the following...
Who knows to do this topic with python code? Write a program to perform the following two tasks: 1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop and...
The driver’s license office DMV has asked you to write a program that grades the written...
The driver’s license office DMV has asked you to write a program that grades the written portion of the driver’s license questions. The questions has 20 multiple-choice questions. Here are the correct answers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B D A A A C B C D A D C C D D B A B C D Your program should store these correct answers...
Does anyone know how to do pseudocode on this topic? Write a program to perform the...
Does anyone know how to do pseudocode on this topic? Write a program to perform the following two tasks: 1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop...
Nora is an RN who has been asked to present the topic of puberty to a...
Nora is an RN who has been asked to present the topic of puberty to a fourth grade health class at the local elementary school. 1. What should she know about the physiology of puberty? 2. What are common changes noted by both sexes in puberty? 3. What are common psychosocial changes in puberty? 4. What health education in addition to the physiologic and social aspects of puberty would be appropriate? 5. One of the parents who came to pick...
Should a physician who has/had a substance abuse addiction be permitted to retain their license to...
Should a physician who has/had a substance abuse addiction be permitted to retain their license to practice medicine? What are the laws or ethics in your state on this subject?
Should a physician who has/had a substance abuse addiction be permitted to retain their license to...
Should a physician who has/had a substance abuse addiction be permitted to retain their license to practice medicine? What are the laws or ethics in your new york state on this subject?
1. Janet knows a lot of people who do not like? Marmite®, a yeast extract that...
1. Janet knows a lot of people who do not like? Marmite®, a yeast extract that is used as a spread on toast. She says that Marmite is so unpopular that? Unilever, the company that manufactures? Marmite®, cannot possibly have any monopoly power. Do you agree with this? analysis? A. ?No, monopoly power is based on whether a good has any close? substitutes, not whether your friends like the product. B. ?Yes, if a good is not widely liked by?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT