Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Linux Shell Prpgramming 1.Write a quiz-script which will provide some statistics about a quiz results (summarize how many good answers and how many wrong answers
- Linux Shell Prpgramming
- 1.Write a quiz-script which will provide some statistics about a quiz results (summarize how many good answers and how many wrong answers were provided). The script should use up to 3 execution parameters. When executed with two parameters (lets call it interactive mode), it should assume, that the first file contains a list of questions and the second file contains correct answers to these questions. In such execution case your script should display questions one by one and wait for users response. The users response should be then compared with the correct answer so that specific questions read from the file containing answers and as a result the script should produce statistics as to how many good and how many wrong answers were provided.
Questions should be formed so that either, YES or NO answer would apply. Questions file format can by any, whilst the answers format should contain only YES or NO answers, one answer per line. There should be exactly 10 questionsin the quiz.
Assuming that file containing questions is qfileand the file containing answers isafile, to run your script in the interactive mode it should be executed as:
./scriptname qfile afile
How to test:
- Create a text file containing a number of questions.
- Create a text file containing correct answers to these questions.
- Execute your script:
- It should ask questions one at a time and then wait for your answer.
- Your answer should be then compared with the appropriate answer read from the file with answers,
- Depending on the correctness of your answer, the script it should count the answer and display statistics as:
Number_of_correct_answers Number_of_wrong_answers
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started