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.
95 exam-style questions on OCR GCSE Computer Science Programming fundamentals. Each one has a worked solution and a mark scheme showing where the marks go.