Question

In: Computer Science

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 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. Python 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

Program:

correctAnswers=["B","D","A","A","C","A","B","A","C","D","B","C","D","A","D","C","C","B","D","A"]
studentAnswers = []
questionNums=[]
i = 1
print("Enter your answers : ")
while (i <= 20):
    answer = input() # Taking answers input from user
    if (answer == "A" or answer == "B" or answer == "C" or answer == "D"):
        studentAnswers.append(answer)
        i = i + 1
    else:
        print("Please enter a valid answer")
    
for x in range(20):
    if correctAnswers[x] != studentAnswers[x]: # Comparing the answers
        questionNums.append(x+1)
        
if len(questionNums) > 5:
    print("Oops!! You have failed the exam")
else:
    print("Yayy!! You have passed the exam")
# Printing output
print("Total corrected answers :", 20-len(questionNums))
print("Total incorrected answers :", len(questionNums))
print("Incorrected question numbers list :", questionNums)

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 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...
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...
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....
Driver’s License test. Write a program that grades the written portion of the driver’s license test....
Driver’s License test. Write 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: ( use array to store ) 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 A student must correctly answer ( use array to...
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?...
Program is to be written in C++ using Visual studios Community You are to design a...
Program is to be written in C++ using Visual studios Community You are to design a system to keep track of either a CD or DVD/Blu-ray collection. The program will only work exclusively with either CDs or DVDs/Blu-rays since some of the data is different. Which item your program will work with will be up to you. Each CD/DVD/Blu-ray in the collection will be represented as a class, so there will be one class that is the CD/DVD/Blu-ray. The CD...
You are working as an assistant in a design office. A developer in your local area...
You are working as an assistant in a design office. A developer in your local area has contacted your company looking for advice as to what would be a suitable project to meet the needs of the local community but also be a profitable investment. The developer is considering a number of different sites in the area. please research your local area(Hong Kong) and select an appropriate construction-based project. Topic:Minimising risk through design and specification P8 Utilise appropriate forms of...
Design a program that displays the following in Java: Enter the grades for an Essay: Grammer...
Design a program that displays the following in Java: Enter the grades for an Essay: Grammer (must be 30 or less): 40 Grammer (must be 30 or less): 26.3 Spelling (must be 20 or less): 17.4 Correct Length (must be 20 or less): 19 Content (must be 30 or less): 23.5 The recorded scores are: Grammer: 26.3 Spelling: 17.4 Correct Length: 19.0 Content: 23.5 Total score: 86.2 The grade for this essay is B
Registrar’s Office members design a study of students’ performance. They believe that individual course grades measured...
Registrar’s Office members design a study of students’ performance. They believe that individual course grades measured in a 100-point scale are normally distributed with the population standard deviation = sigma = 19 points. The goal is to estimate the population mean with the interval no wider than 9 points. 1. Set confidence level = C = 0.99 and find the smallest number of records required for the study goals. 2. Will a sample of n = 100 records guarantee that...
2. You have been asked to `present on the foundational principles of conditioning program design to...
2. You have been asked to `present on the foundational principles of conditioning program design to a group of dieticians who have studied exercise science in theory, but now seek ideas on how to apply their knowledge in practice. Draft 6-8 key talking points to illustrate scientific exercise programming principles and expand on each of the talking points you identify to clarify their application.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT