Question 13

From Computer Science HL Paper 1 (May 2024, TZ2)

  1. (a) Define the NOR Boolean operator. [1]

A car has features that monitor its speed, direction and distance from the car in front. This is shown in Figure 1.

Figure 1: Rules to control car motion

Table showing input, binary representation, and description for car control rules.
Table showing input, binary representation, and description for car control rules.

For example, if the car is travelling forward, input B would have a binary representation of 1.

(b) Construct a logic diagram with inputs A, B, and C and output Z to represent the following scenario:
Output Z equals 1 when:

  • the car is travelling forward AND it is less than 20 metres from the vehicle in front.
    OR
  • the car speed is more than 130 km per hour.
    In all other conditions, output Z equals 0. [4]

An additional row (input D) is to be added to assist when the car is in reverse or stationary.
Input D checks if there are obstructions less than 3 metres from the rear of the car.

(c) State the rules that need to be added to Figure 1 to test this condition. [2]

(Question 13 continued)

Information similar to that presented in Figure 1 could be used to construct decisions and conditions in program design (see Figure 2).

Figure 2: Identifiers for car motion rules
(Table showing Identifier F, S, T and their descriptions)

(d) Determine the value of the following expression given that the input values for F, S and T are:
F = 40
S = 115
T = true
F >= 25 AND S >= 5 AND S <= 130 AND T = true
You must show your working. [2]

(e) Construct an algorithm in pseudocode that repeats the following steps while the car is moving:

  • Input the value for the distance from the vehicle in front.
  • Input the value for the speed of the car.
  • Check the inputs and notify the user if either the distance from the car in front is less than 15 metres or if the speed of the car is more than 115 kilometres per hour.
    The algorithm will only terminate when the car stops moving. [6]