AQA 8525 GCSE Computer Science · 3.2 Programming

Stretch tasks Programming Fundamentals

Task 1

Quiz Challenge

A quiz game against four computer players, then short and long written answers.

  1. Quiz Blitz12 questions against the clock
  2. Quick Fire4 short answers
  3. Big Think2 long answers

About 20 minutes

Task 2

This or That

Pixel the cat asks 8 questions. Each has two answers: pick the right one.

  • Two answers to every question
  • A fish treat for every right answer
  • Streaks win Pixel shades, then a party hat

About 4 minutes

Task 3

Memory Match

Flip the cards two at a time to match each expression card to its value card.

  • 12 cards: each expression has a value
  • One peek at every card
  • Combo points for pairs found in a row

6 pairs, about 4 minutes

Task 4

Sort It

Sort each statement into the right box, like the tick-box tables in the exam.

  • 12 cards to sort into 4 boxes
  • Drag a card, tap a box or press its number
  • Combo points for cards sorted in a row

12 cards, about 4 minutes

The games need JavaScript. Every question is below, with the answers at the end.

Read the lesson: Programming Fundamentals

Programming Fundamentals: the questions

Quiz Challenge, round 1: Quiz Blitz

  1. Which AQA data type holds a single letter such as 'K'?

    • String
    • Integer
    • Boolean
    • Character
  2. What is output?

    OUTPUT 7 DIV 2

  3. What is output?

    OUTPUT 7 MOD 2

  4. What is output?

    OUTPUT 7 / 2

  5. What does count ← count + 1 do?

    • Makes count a constant
    • Sets count to 1
    • Adds 1 to count and stores the result back in count
    • Checks whether count equals count + 1
  6. Why does IF grade = 'A' OR 'B' not work?

    • Each side of OR must be a complete comparison
    • OR cannot be used with strings
    • IF always needs an ELSE
    • Grades must be integers
  7. Every relational operator, such as < or ≥, produces a Boolean.

    • True
    • False
  8. A mark of 80 is entered. What is grade?

    IF mark ≥ 40 THEN
        grade ← 'Pass'
    ELSE IF mark ≥ 70 THEN
        grade ← 'Distinction'
    ENDIF
    • Distinction
    • Nothing
    • An error
    • Pass
  9. How can you test whether n is even?

    • n DIV 2 = 0
    • n / 2 = 1
    • n MOD 2 = 1
    • n MOD 2 = 0
  10. seconds ← 135. What is seconds DIV 60?

  11. Which is count-controlled iteration?

    • WHILE password ≠ stored
    • REPEAT ... UNTIL found
    • IF x > 5 THEN
    • FOR i ← 1 TO 5
  12. Which TWO are reasons to use a constant?

    Tick 2.

    • The value is changed in only one place
    • The program cannot change it by accident
    • It saves typing the name
    • It makes loops run faster
    • It lets users edit the value

Quiz Challenge, round 2: Quick Fire

  1. Explain why the bit pattern 01000001 needs a data type before it can be used. [2 marks]

  2. Explain how DIV and MOD can turn 135 seconds into minutes and seconds. [2 marks]

  3. Explain the difference between count-controlled and condition-controlled iteration. [2 marks]

  4. A program gives Distinction for 70 or more and Pass for 40 or more. Explain why the order of its IF and ELSE IF tests matters. [2 marks]

Quiz Challenge, round 3: Big Think

  1. Write an algorithm in AQA pseudo-code that keeps asking for a password until it matches the stored one, then displays a welcome message. [4 marks]

  2. A program stores a VAT rate of 0.2 and uses it in many calculations. Explain why it should be a constant, and how a constant differs from a variable. [4 marks]

This or That: tick the right answer

  1. Which data type is 2.0?

    • Integer
    • Real
  2. Which data type is "7"?

    • Integer
    • String
  3. Which AQA symbol means not equal to?

    • ←
    • ≠
  4. seconds ← 135. What is seconds MOD 60?

    • 15
    • 2
  5. Which keyword declares a fixed value in AQA pseudo-code?

    • CONSTANT
    • FIXED
  6. What does n MOD 10 give?

    • The last digit of n
    • n divided by 10
  7. IF age ≥ 13 AND age ≤ 19. Which age makes it true?

    • 21
    • 15
  8. A loop must process every item in a list of known length. Which loop suits it?

    • A condition-controlled REPEAT loop
    • A count-controlled FOR loop

Memory Match: match each expression to its value

ExpressionValue
A 7 / 21 3
B 7 DIV 22 1
C 7 MOD 23 7
D 135 DIV 604 3.5
E 135 MOD 605 2
F 2 * 3 + 16 15

Sort It: tick one box in each row

Which AQA data type suits each value?

StatementIntegerRealCharacterString
A postcode
An empty string, ""
-0.5
-40
3.14
A height of 1.75 metres
The number of people in a queue
One digit character, such as '7'
2025
"Hello"
A single initial, such as 'J'
'K'
Answers

Round 1: Quiz Blitz

  1. Character A character is one character. A string is a sequence of them.
  2. 3 DIV keeps only the whole number part: 2 goes into 7 three times.
  3. 1 MOD gives the remainder: 7 is 3 x 2 with 1 left over.
  4. 3.5 / is real division, so the answer keeps its fractional part.
  5. Adds 1 to count and stores the result back in count Work out the right-hand side, then store it in the name on the left.
  6. Each side of OR must be a complete comparison It must be IF grade = 'A' OR grade = 'B'. Examiners set this trap deliberately.
  7. True That is their whole point: selection and iteration can then test the result.
  8. Pass 80 ≥ 40 is true, so the first branch runs and the rest is skipped. The most restrictive test must come first.
  9. n MOD 2 = 0 An even number leaves no remainder when divided by 2.
  10. 2 60 goes into 135 twice: 2 whole minutes.
  11. FOR i ← 1 TO 5 The number of repeats is known before the loop starts.
  12. The value is changed in only one place; The program cannot change it by accident A named constant also makes the code more readable: price vat, not price 0.2.

Round 2: Quick Fire

    • The same bits could be the integer 65 or the character A
    • The type tells the computer how to interpret the bits
    Model answer

    The same bits could be the integer 65, the character A, or part of a real number. The data type tells the computer how to interpret the bits.

    • 135 DIV 60 is 2, the whole minutes
    • 135 MOD 60 is 15, the seconds left over
    Model answer

    135 DIV 60 is 2, the whole number of minutes. 135 MOD 60 is 15, the seconds left over. So 135 seconds is 2 minutes 15 seconds.

    • Count-controlled repeats a number of times known before it starts
    • Condition-controlled repeats until a condition changes, an unknown number of times
    Model answer

    Count-controlled iteration, such as a FOR loop, repeats a number of times known before it starts. Condition-controlled iteration, such as WHILE or REPEAT, repeats until a condition changes, so the number of repeats is unknown.

    • A mark such as 80 meets both tests
    • The first true test wins, so the most restrictive must come first
    Model answer

    A mark such as 80 meets both tests, and only the first true test runs, so the most restrictive test, 70 or more, must come first, or every passing student gets a Pass.

Round 3: Big Think

    • Uses a REPEAT or WHILE loop
    • Takes the password with USERINPUT
    • Compares the entry with the stored password
    • Outputs the message after the loop
    Model answer
    AQA pseudo-code
    REPEAT
        password ← USERINPUT
    UNTIL password = stored
    OUTPUT 'Welcome'
    • A constant is fixed and cannot change while the program runs
    • A variable's value can change
    • A named constant makes the code more readable
    • If the rate changes, it is edited in one place
    • The program cannot change it by accident
    Model answer

    A constant is fixed when the program is written and cannot be changed while it runs, whereas a variable's value can change. Using a constant such as vat makes the code more readable, because price * vat explains itself. If the rate changes, it is edited in one place rather than everywhere 0.2 appears, and the program cannot change it by accident.

This or That

  1. Real It has a fractional part, even though it is zero.
  2. String In quotes, 7 is a character string that just looks like a digit.
  3. ≠ ← is assignment. ≠ is the relational operator not equal to.
  4. 15 MOD gives what is left over: 135 is 2 x 60 with 15 left over.
  5. CONSTANT For example, CONSTANT vat ← 0.2.
  6. The last digit of n The remainder after dividing by 10 is the units digit.
  7. 15 AND needs both comparisons to be true, and 21 is more than 19.
  8. A count-controlled FOR loop The number of repeats is known, so a FOR loop is the right choice, and saying why earns the mark.

Memory Match

  • A 4 7 / 2: 3.5
  • B 1 7 DIV 2: 3
  • C 2 7 MOD 2: 1
  • D 5 135 DIV 60: 2
  • E 6 135 MOD 60: 15
  • F 3 2 * 3 + 1: 7

Sort It

  1. String A postcode It mixes letters, digits and a space.
  2. String An empty string, "" A string can hold no characters at all.
  3. Real -0.5 A real can be negative and fractional.
  4. Integer -40 A whole number, positive or negative, is an integer.
  5. Real 3.14 It has a fractional part.
  6. Real A height of 1.75 metres Heights need a fractional part.
  7. Integer The number of people in a queue You cannot have half a person.
  8. Character One digit character, such as '7' In quotes, '7' is a character, not a number.
  9. Integer 2025 A whole number with no fractional part.
  10. String "Hello" A sequence of characters is a string.
  11. Character A single initial, such as 'J' One character on its own.
  12. Character 'K' A single character.