The local Driver's License Office has asked you to write a program which grades the written portion of their driver's license exams. The program will allow an unlimited number of drivers’ exams to be graded.
The exam has 20 multiple choice questions. The correct answers are:
1. A 2. D 3. B 4. B 5. C 6. B 7. A 8. B 9. C 10. D 11. A 12. C 13. D 14. B 15. D 16. C 17. C 18. A 19. D 20. B
In main, declare an array and initialize it with the above correct answers, declare a second array for an exam taker's answers, and get a text file name from the user.
Also in main, repeatedly have the user enter an exam taker’s full name, determine whether the exam taker has passed or failed the exam, and display the results.
This program will have two functions:
1) have the user enter 20 answers from an exam taker and write the answers to the text file (validate that the answers are A, B, C, or D). See the 20 exam taker's answers below.
Hint: open (and close) the file in the function.
2) read the text file of the exam taker's answers and store them in the exam taker's array, which was declared in main.
Then in main, the program should display the following information:
-whether the exam taker passed or failed (15 of the 20 answers must be correct).
-total number of questions answered correctly
-total number of questions answered incorrectly
-a list of the numbers of the questions answered incorrectly (question numbers are 1-20).
Arrays must be processed using loops, and all variables and constants must be local (not global).
Two of the exam takers' answers are:
Exam Taker #1: 1 A 2. C 3. B 4. B 5. C 6. D 7. A 8. B 9. C 10. D 11. C 12. C 13. D 14. D 15. D 16. C 17. C 18. A 19. D 20. C
Exam Taker #2: 1. C 2. D 3. D 4. B 5. A 6. B 7. C 8. B 9. C 10. D 11. C 12. C 13. D 14. D 15. D 16. C 17. C 18. A 19. D 20. C
It's more of a trade secret than a code but to crack this job you'll probably need to get hold of a programmer. Either that or have a go at doing it yourself. :)