Maths quiz algorithm with harder and easier questions

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Maths quiz algorithm with harder and easier questions

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A quiz algorithm keeps a variable called score. What should happen to score when the student gives a RIGHT answer?
A score ← score + 1
B score ← 0
2. Which step belongs inside the loop so the quiz keeps asking questions?
A REPEAT: ask a question, check the answer
B Ask one question, then stop
3. The quiz has this rule: IF the student gets two wrong answers in a row THEN ask an easier question. What kind of step is this?
A Sequence only, because every student gets the same steps
B Branching, because the algorithm chooses a path based on a condition
4. Where should the line 'score ← 0' go in a quiz algorithm?
A At the start, before the first question
B Inside the loop, after every question
5. A student answers 7 × 8 and gets it wrong. What happens to the score variable?
A It goes up by 1
B It stays the same

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1IF answer = correct THEN score ← score + 1 AThe branch resets the score instead of choosing an easier question. It should pick an easier question when wrongInRow is 2.
2IF wrongInRow = 2 THEN use easier question Bscore ← 0
3The quiz repeats the question steps until 5 questions have been asked CIf the answer is right, add 1 to the score variable
4The quiz starts with a score variable set to 0 before any questions are asked DREPEAT UNTIL questionsAsked = 5
5IF answer = correct THEN score ← 1 EThis sets score to 1 instead of adding 1. The score will never go above 1. It should be score ← score + 1.
6IF wrongInRow = 2 THEN score ← 0 FAfter two wrong answers in a row, switch to an easier question

Definitions

quiz algorithm

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
SET score ← 0 ______ 5 TIMES ASK a maths question
2.
IF answer = correct THEN SET score ← score _ 1 END IF
3.
IF answer = correct THEN SET _____ ← score + 1 END IF
4.
IF wrong = _ THEN ASK an easier question END IF
5.
IF score __ 4 THEN ASK a harder question END IF

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A score ← 0
B REPEAT 5 TIMES
C ASK a maths question
D IF answer is wrong THEN
E score ← score + 1
Question 2
A score ← 0
B wrong ← 1
C ASK a maths question
D IF answer is right THEN
E score ← score + 1
Question 3
A score ← 0
B ASK a maths question
C IF answer is right THEN
D score ← score - 1
Question 4
A score ← 0
B REPEAT 5
C ASK a maths question
D IF answer is right THEN
Question 5
A score ← 0
B wrong ← 0
C IF answer is wrong
D wrong ← wrong + 1
E IF wrong = 2 THEN

Answer Key

Maths quiz algorithm with harder and easier questions
Section A: Quick Questions
Q1
A — score ← score + 1
Q2
A — REPEAT: ask a question, check the answer
Q3
B — Branching, because the algorithm chooses a path based on a condition
Q4
A — At the start, before the first question
Q5
B — It stays the same
Section B: Match the Pairs
Q1
IF answer = correct THEN score ← score + 1 → If the answer is right, add 1 to the score variable
Q2
IF wrongInRow = 2 THEN use easier question → After two wrong answers in a row, switch to an easier question
Q3
The quiz repeats the question steps until 5 questions have been asked → REPEAT UNTIL questionsAsked = 5
Q4
The quiz starts with a score variable set to 0 before any questions are asked → score ← 0
Q5
IF answer = correct THEN score ← 1 → This sets score to 1 instead of adding 1. The score will never go above 1. It should be score ← score + 1.
Q6
IF wrongInRow = 2 THEN score ← 0 → The branch resets the score instead of choosing an easier question. It should pick an easier question when wrongInRow is 2.
Section C: Definitions
Q1
quiz algorithm — An algorithm that repeats questions, adds 1 to a score variable for each right answer, and picks harder or easier questions depending on that score.
Section D: Fill in the Blanks
Q1
SET score ← 0 REPEAT 5 TIMES ASK a maths question
Q2
IF answer = correct THEN SET score ← score + 1 END IF
Q3
IF answer = correct THEN SET score ← score + 1 END IF
Q4
IF wrong = 2 THEN ASK an easier question END IF
Q5
IF score >= 4 THEN ASK a harder question END IF
Section E: Spot the Error
Q1
D — The score should go up when the answer is right. The line should be IF answer is right THEN, so that score ← score + 1 only runs for a right answer.
Q2
B — The student has not answered anything yet, so the wrong counter must start at 0. It should be wrong ← 0.
Q3
D — A right answer adds 1 to the score. It should be score ← score + 1, not minus 1.
Q4
B — The repeat line must say how many times to repeat. It should be REPEAT 5 TIMES.
Q5
C — An IF line needs the word THEN at the end. It should be IF answer is wrong THEN.