Exam-style question
Try this first
An online retail company needs to store product information. Each product has a unique `ProductID` (e.g., 'ELEC001'), a `ProductName` (e.g., 'Laptop Pro X'), and a `Price` (e.g., 1200.50). The company also wants to keep track of the `StockLevel` (e.g., 50) for each product. Describe how you would use a combination of data structures to store information for 100 different products. Justify your choice of data structures. [6 marks].
Answer and explanation
Concise answer
I would use a record (or structure) to represent a single product.
Why this is correct
1 mark for identifying a record for a single product. 1 mark for listing appropriate data types for each field within the record (e.g., ProductID: string, ProductName: string, Price: real/decimal, StockLevel: integer). 1 mark for identifying a one-dimensional array to store multiple records. 1 mark for justifying the use of a record to group different data types for a single entity.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
