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

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. Q17 9618/32/M/J/25 original Q1 Structured · 6 marks Worked solution (a) Write the record name, a dot, then the field name, and use ← to assign. Text goes in quotes. Flight1.FlightNumber ← "SB2789" Flight1.Destination ← "Dublin" Flight1.FlightDate ← 30/07/2025 Flight1.Gate ← "N03" Flight1.Airline ← "Cambridge Airways" Correct variable Flight1 used with the given field names [1] The four string values assigned correctly [1] The date value assigned correctly [1] (b)(i) List the codes in brackets. TYPE GateID = (N01, N02, N03, W01, W02, W03, W04) TYPE GateID = [1] All seven codes in brackets [1] (b)(ii) The field now has the new type. DECLARE Gate : GateID Correct declaration of Gate with type GateID [1] KEY IDEA Use variable.field with ← to fill a record, and an enumerated type lists all its allowed values in brackets. TOTAL 6 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by ZAINEMATICS. Tap the picture to open it on YouTube.