This section looks at how to answer some of the popular examination style questions. Click the + to expand each section.
Example Question: Streetlights are controlled automatically using sensors and a microprocessor to turn on and off as needed depending on how dark or light it is outside Describe the microprocessing involved in such a system and role of the sensors.
HOW TO ANSWER: In a microprocessor question always ensure you explicitly mention input, process and output. Then plan to break each section into 2 points or sub sections. 1: INPUT A: Name the input device B: Mention the need for an Analogue to Digital Converter 2: PROCESS A: Check against pre-set values B: Run a conditional process 3: OUTPUT A: Name of output device or category of device B: Action of the output device
EXAMPLE ANSWER: An input device such as a light sensor detects the light level, a signal is sent from the input device to the processor via an analogue to digital converter(ADC). The microprocessor receives the value and compares it to pre-set values and determines if the value is greater, less than or within the pre-set values. If needed a signal is sent to the actuator, an output device such as a light bulb and the light is turned on or off. The whole process is continually repeated in a loop. To avoid continuous/rapid change of state a delay may be added, so for example it should remain dark for a pre-set period of time before a signal is sent to turn the light on.
SAMPLE CASE STUDY
This case study is taken from the Cambridge CIE 2016 examinations (https://www.cambridgeinternational.org/)
Write and test a program to complete the three tasks.
TASK 1 A data logger records the temperature on the roof of a school twice a day, at midday and midnight.
Input and store the temperatures recorded for a month. You must store the temperatures in two one-dimensional arrays, one for the midday temperatures and one for the midnight temperatures. All the temperatures must be validated on entry and any invalid temperatures rejected. You must decide your own validation rules. You may assume that there are 30 days in a month.
TASK 2 Calculate the average temperature for midday and the average temperature for midnight. Output these averages with a suitable message for each one.
TASK 3 Select the day with the highest midday temperature and the day with the lowest midnight temperature. Then output each of these temperatures, the corresponding day and a suitable message. Your program must include appropriate prompts for the entry of data. Error messages and other outputs need to be set out clearly and understandably. All variables, constants, functions and other identifiers must have meaningful names. Each task must be fully tested.