-
Notifications
You must be signed in to change notification settings - Fork 1
Prisha Create Task
Create Task One-Minute Video Link: https://drive.google.com/file/d/1MC9QIr6Zt-_QvZVwjWtfa4SvADldXGZz/view?usp=sharing
Purpose: Create a quiz for users to take that allows them to study for their computer science quiz
Functionality: Simple multiple choice quiz, the program keeps track of the right answers and the wrong answers.
Inputs/Outputs: Three questions and four possible answers for each. Users can click on the answers and see if they are correct or incorrect.
Two program code segments:
The myQuestions array is used to store the different questions and answers that are part of the quiz. The following function takes values from the subarray questions and matches them with values from the subarray answers and checks to see if the correct answer lines up with what the user selected. If it is correct, the program changes the text color to green and increases the score of correct answers but if it is wrong, it changes it to red and does nothing to the score.
If the array hadn’t been written, you would have to write out each question and answer several times as you write out radio buttons and check to make sure the user’s input is correct.
The procedure changes the score of the person taking the quiz. The original score is set at zero and when the correct answer is selected, the score increases by one.
User’s answer must be inputted. If the user's answer matches the correct answer, the score increases by one.
The score must be a value from 0 to the length of the subarray questions.It shows the numbers correct that the user got.