Term 2 in review
Answers are for parents and teachers.
1
A bag-storage locker accepts a weight from 1 to 20 kg inclusive and prints Accepted or Refused. Complete the table with the kind of data and the expected output for the weights 1, 10, 20, 21 and 0.
| Weight in kg | Kind of data | Expected output |
|---|---|---|
| 1 | ? | ? |
| 10 | ? | ? |
| 20 | ? | ? |
| 21 | ? | ? |
| 0 | ? | ? |
1: normal, extreme and boundary, Accepted. 10: normal, Accepted. 20: normal, extreme and boundary, Accepted. 21: invalid (and boundary), Refused. 0: invalid (and boundary), Refused.
2
Trace this program with a table that has the columns n, total and Output. What does it print?
Python
1n = 3 2total = 0 3while n <= 12: 4 total = total + n 5 n = n + 4 6print(total)
Start: n 3, total 0. Pass 1: total 3, n 7. Pass 2: total 10, n 11. Pass 3: total 21, n 15. Now 15 <= 12 is false, so the loop ends and it prints 21.
3
The fee rate 0.2 is in E1 and C2 holds =B2*$E$1, filled down to C4. Write the formula in C4 and the value it shows. What would go wrong if the $ signs were left out?
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Day | Sales | Fee | Rate | 0.2 |
| 2 | Mon | 30 | 6 | ||
| 3 | Tue | 45 | 9 | ||
| 4 | Wed | 20 | ? |
C4 holds =B4*$E$1 and shows 20 × 0.2 = 4. Without the $ signs, the formula in C4 would become =B4*E3, which points at an empty cell, and the result would be wrong (0).
4
The Hives table stores Keeper_ID and not the keeper’s name and village. Explain why this is better, and what could go wrong if every hive record held the name and village.
Each keeper is stored once in the Keepers table, so a change (such as a new village) is made in one place. If the name and village were repeated in every hive record, a change made in only one record would leave the others out of date, which is an update anomaly, and the data would waste space.
5
A tutoring centre has five computers and a printer and wants a network that keeps working when one computer is switched off. Choose a topology and give two reasons. Name its weak point.
Model answer: a star. Each computer has its own cable to the switch, so switching one off does not affect the others, and a broken cable cuts off only one device. The weak point is the switch, a single point of failure.