Exam-style question
Try this first
A programmer needs to store information about multiple employees, where each employee has a name (text), an ID number (integer), and a salary (decimal). Which data structure would be most appropriate to represent a single employee?.
- A.A one-dimensional array
- B.A two-dimensional array
- C.A string
- D.A record
Answer and explanation
Concise answer
A record
Why this is correct
A record (or structure) is ideal for grouping related data items of potentially different data types, such as an employee's name (string), ID (integer), and salary (decimal). Arrays store items of the same data type. Strings store character sequences.
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.
