An automated library checkout machine allows library items to be scanned and processed. Each type of library item has a two-letter prefix code. The prefixes are defined in the table below:
| Code | Item Type |
|---|---|
| BK | Book |
| DG | Digital Media |
| MG | Magazine |
A program is written to process these items at checkout. The program:
CheckItemCode() to verify whether the entered prefix code is valid.CheckoutItem() is called.01 itemType = input("Enter the code for the item type:")
02 if CheckItemCode(itemType) then
03 itemNumber = input("Enter the unique item number:")
04 itemSKU = itemType + itemNumber
05 CheckoutItem(itemSKU)
06 endif
Identify two programming constructs that have been used in the program above.
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.