A smart garden irrigation system uses different watering devices. Each type of device has a code as shown in the table:
| Code | Device |
|---|---|
| SP | Sprinkler |
| DR | Drip emitter |
| MS | Moisture sensor |
A program is written to activate these devices. The program:
IsValidDeviceCode() to check whether the entered code is valid.ActivateDevice() using a combined device identifier.01 deviceType = input("Enter the device code to activate")
02 if (IsValidDeviceCode(deviceType)) then
03 zoneNumber = input("Enter the zone number for the device")
04 combinedID = deviceType + zoneNumber
05 ActivateDevice(combinedID)
06 endif
Give the identifier of a variable used in the program.
Practise OCR GCSE Computer Science Programming fundamentals with exam-style questions for GCSE Computer Science. 100 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.