Question 1 Report
A wildlife camera program sends a new message to researchers when movement is detected at night but the camera is not in maintenance mode. The sensor subroutine gives movement, the clock subroutine gives night, and an engineer sets maintenance. The program uses sendMessage = movement AND night AND NOT maintenance. During field testing, an animal moves during the day. In another test, movement occurs at night while maintenance is enabled. Researchers need to understand why neither event should send a message.
(a) Explain why maintenance mode is negated in the statement. [2]
(b) When movement is True, night is False and maintenance is False, state the value of sendMessage. [1]
(c) When movement is True, night is True and maintenance is True, state the value of sendMessage. [1]
(d) Explain why AND is suitable for the three checks. [1]
Fig. 1 shows part of the access-control program used at a community workshop. A member may use the laser cutter only if their card is valid and they have completed safety training. The two input values are stored as Boolean variables. The main program displays a message telling the member whether access is allowed. The programmer wants the condition to be clear so that a technician can test it using all possible input combinations.
(a) Explain when accessAllowed is True. [2]
(b) When cardValid is False and trained is True, state the value displayed for accessAllowed. [1]
Wildlife-camera condition
maintenance must be False, represented by NOT maintenance being True. [1]sendMessage is False. [1]NOT True is True AND True AND False, so sendMessage is False. [1]AND is suitable because all three required conditions must be satisfied: movement, night-time, and no maintenance mode. [1]Workshop access condition
accessAllowed is True only when the card is valid [1] and safety training is complete, so trained is True. [1]accessAllowed displays False. [1]Everything you need to excel in your exams