lnf.cymru stimulus sheet · Computer Science · Year 8
The youth club, the quiz and Efa are invented. DIV, MOD and the comparison symbols are real and are used in programming.
Efa is programming a quiz for Cwm Ystrad youth club. Her program counts time in seconds, so after a round it shows “Time: 125”. The players want to see minutes and seconds, like “2:05”. Efa also needs to turn the club leader’s rules, written in words, into symbols the program can use.
| Symbol | Meaning | Example |
|---|---|---|
| * | multiply | 2 * 60 = 120 |
| / | divide (can give a decimal) | 125 / 60 = 2.0833… |
| DIV | whole-number division: how many whole times | 125 DIV 60 = 2 |
| MOD | the remainder after whole-number division | 125 MOD 60 = 5 |
| = | is equal to | score = 10 |
| <> | is not equal to | answer <> 4 |
| < | is less than | age < 11 |
| > | is more than | time > 600 |
| <= | is less than or equal to | time <= 10 |
| >= | is more than or equal to | score >= 50 |
| AND | both parts must be true | age >= 11 AND age <= 14 |
| OR | at least one part must be true | score >= 50 OR time > 600 |
Watch out: the symbol is <=, never =<. The two characters go in the same order as you say them: “less than, or equal to”.
Units: write s for seconds, min for minutes and h for hours, with a space after the number: 125 s = 2 min 5 s. The display 2:05 has no units. There are 60 s in 1 min and 3,600 s in 1 h.
| Rule | In words |
|---|---|
| R1 | A player gets a speed bonus if they answer in 10 seconds or less. |
| R2 | Every 3rd question is a picture round. |
| R3 | The game ends when the score reaches 50 or more, or when the time is more than 600 seconds. |
| R4 | A player can join if they are aged 11 or over and 14 or under. |
| R5 | A warning shows if the player’s answer is not equal to the correct answer. |
| R6 | Even-numbered questions are worth double points. |
Efa wrote these notes while testing. Some are not in correct form.
| Line | Efa wrote |
|---|---|
| L1 | 125 / 60 = 2.08 so the display shows 2:08 |
| L2 | 200 DIV 60 = 3 r 20 |
| L3 | 359 s = 5:59 min |
| L4 | 600 MOD 60 = 10 |
| L5 | bonus if time =< 10 |
| L6 | 95 s = 1 min 35 s |