ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2018 Question 4

3 marks · Selection and logical operators

State the smallest light sensor value that would result in the security light being off. The value 765·2 would be stored in a computer system using ‘floating-point representation’ as shown below. 0·7652 × 10³ Identify the mantissa and exponent in the above floating-point representation. Mantissa Exponent The program below is used to switch a security light on or off depending on a reading taken from a light sensor. Line 1 DECLARE storedLight INITIALLY 765.2 Line 2 RECEIVE reading FROM <light sensor> Line 3 IF reading < storedLight THEN Line 4 <switch on light> Line 5 ELSE Line 6 <switch off light> Line 7 END IF

Marking scheme

765∙2 Mantissa – 7652 Exponent - 3

Previous question: N5 Computing Science 2018 Question 3

Next question: N5 Computing Science 2018 Question 5