At a Leeds school race, the timer shows 58 seconds. Whose time is it?
At a school race in Leeds, the timer has saved a time of fifty-eight seconds. The race marshal needs to know whose time it is and whether their finish has been confirmed. Can a list of times tell you that?
For one run, you can store the times in a one-dimensional array and use one position to find a time, such as fifty-eight seconds. For two runs, a two-dimensional array uses a row for each runner and a column for each run. The entries still give you only times.
Watch what happens when we put all three details for one runner together. The name is Asha, the time is fifty-eight seconds, and finished is false because her finish hasn't been confirmed yet. Each label tells you what its value means.
Think back to the three labels you saw for Asha: name, time and finished. The marshal wants to know whether Asha's finish has been confirmed. Which label gives you that information directly? Pick one answer.
That group of details about Asha is a record. Each named part is a field. Fields in the same record can hold different types of data. Here the name is a string, the time is an integer in seconds, and finished is a Boolean.
Create a record called r with Asha's name, a time of fifty-eight seconds and finished set to false. Read r dot name to store Asha in the variable runner name. When the marshal confirms the finish, set r dot finished to true. The other fields stay the same.
Ben's record has a time of sixty-three seconds and finished set to false. The marshal now confirms Ben's finish. Which line updates just the field that needs to change? Pick the best answer.
On the left, one record per property splits Asha's name, time and finish flag across three records. On the right, one record per runner keeps those three fields together. Asha gets her own record, and Ben gets his own record with the same field names.
If the question asks you to describe a suitable data structure for the race results, use a one-dimensional array. Put Asha's record at index zero and Ben's at index one. For each record, give the field names and types: a string for name, an integer for time and a Boolean for finished.