9618/31/M/J/25 question 1: worked solution (May/June 2025, paper 31)

Show as plain text

Cambridge A2 Level Computer Science 9618 · 13.1 User-defined data types Worked solution from the Data Representation Paper 3 Advanced Theory booklet, Part 1 of 3. Q16 9618/31/M/J/25 original Q1 Structured · 6 marks Worked solution (a) An enumerated type lists every allowed value in brackets after TYPE. TYPE Vehicle = (M100, M230, T101, T102, T120, T150) TYPE Vehicle = [1] All six values in brackets [1] (b) Use STRING for text, including codes and telephone numbers (a phone number is not used in sums, and may start with 0). Use DATE for the date and the enumerated type Vehicle for the taxi. TYPE Booking DECLARE BookingNumber : STRING DECLARE Destination : STRING DECLARE ClientName : STRING DECLARE ClientTelephone : STRING DECLARE DateOfDeparture : DATE DECLARE PickupAddress : STRING DECLARE TaxiUsed : Vehicle ENDTYPE TYPE Booking and ENDTYPE correct [1] DECLARE used correctly for every field [1] Any four fields with correct types [1] The remaining fields with correct types [1] KEY IDEA Pick the most suitable type for each field: STRING for codes and phone numbers, DATE for dates and an enumerated type for a fixed list. TOTAL 6 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by ZAINEMATICS. Tap the picture to open it on YouTube.