Year 9TechnologiesSupport
Read the booking rule and its pseudocode. When you trace, write the value of each part before the final output.
Read the text
Fictional makerspace laser cutter booking rule
- [1]
Rule: a student may book the laser cutter if they have completed the safety induction, and they are in Year 9 or 10 or a teacher will supervise them. Nobody may book it while it is under maintenance.
- [2]
Inputs: inducted (TRUE or FALSE), year (a number from 7 to 10), supervised (TRUE or FALSE), maintenance (TRUE or FALSE).
- [3]
INPUT inducted, year, supervised, maintenance
- [4]
IF inducted AND (year >= 9 OR supervised) AND NOT maintenance THEN
- [5]
OUTPUT "Booking allowed"
- [6]
ELSE
- [7]
OUTPUT "Booking refused"
- [8]
ENDIF
- [9]
Order of operations: brackets are worked out first, then NOT, then AND, then OR.
AKnow the operators
AND needs both. OR needs at least one. NOT flips the value.
- 1.
What does AND mean in a condition?
(1 mark)- both parts must be TRUE
- at least one part must be TRUE
- the part must be FALSE
- 2.
What does OR mean in a condition?
(1 mark)- at least one part must be TRUE
- both parts must be TRUE
- neither part can be TRUE
- 3.
NOT maintenance is TRUE when maintenance is FALSE.
(1 mark)- True
- False
- 4.
A = TRUE and B = FALSE. What is A AND B?
(1 mark) - 5.
A = TRUE and B = FALSE. What is A OR B?
(1 mark)
BTrace the rule
Example: year = 8 makes year >= 9 FALSE.
- 6.
Trace: inducted = TRUE, year = 10, supervised = FALSE, maintenance = FALSE. Write the value of each part, then the output.
(2 marks) - 7.
Trace: inducted = FALSE, year = 10, supervised = TRUE, maintenance = FALSE. What is the output and why?
(2 marks)