Skip to content

Prisha Create Task

PrishaB edited this page Feb 28, 2022 · 1 revision

Create Task One-Minute Video Link: https://drive.google.com/file/d/1MC9QIr6Zt-_QvZVwjWtfa4SvADldXGZz/view?usp=sharing

3A:

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.

3B:

Two program code segments:

3Bp1 3Bp2

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.

3C:

3Cp1 3Cp2

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.

3D:

3Dp1

User’s answer must be inputted. If the user's answer matches the correct answer, the score increases by one.

3Dp2

The score must be a value from 0 to the length of the subarray questions.It shows the numbers correct that the user got.

Clone this wiki locally