Cambridge AS & A Level Computer Science 9618 | User-Defined Data Types | Worksheet
User-Defined Data Types
Cambridge AS & A Level Computer Science 9618 | Section 13.1
Topic: Non-Composite and Composite Data Types
Learning Objectives
1. Identify whether a data type is non-composite or composite.
2. Distinguish between enumerated and pointer types within non-composite types.
3. Distinguish between record and set types within composite types.
4. Match real-world data examples to the correct user-defined data type.
Key Concepts
Non-Composite Types Composite Types
Enumerated: A list of named possible values. Record: A collection of fields of different data
Example: types under one identifier.
TYPE TSeason = Example:
(Spring, Summer, Autumn, Winter) TYPE PersonRecord
Pointer: References a memory location. DECLARE Name : STRING
ENDTYPE
Example:
TYPE TIntPointer = ^INTEGER Set: A collection of unique values of the same
data type.
Example:
TYPE TLetterSet = SET OF CHAR
DEFINE Vowels ('A','E','I','O','U')
: TLetterSet
Part 1 — Non-Composite or Composite?
Study each pseudocode declaration below. In the table provided, identify whether each declaration is Non-
Composite or Composite.
Declaration A
TYPE TDirection = (North, South, East, West)
Declaration B
TYPE StudentRecord
DECLARE StudentID : INTEGER
DECLARE FullName : STRING
DECLARE DateOfBirth : DATE
DECLARE IsEnrolled : BOOLEAN
ENDTYPE
Declaration C
TYPE TPointer = ^INTEGER
Page 1 of 2
Cambridge AS & A Level Computer Science 9618 | User-Defined Data Types | Worksheet
Declaration D
TYPE TLetterSet = SET OF CHAR
DEFINE Vowels ('A', 'E', 'I', 'O', 'U') : TLetterSet
Declaration E
TYPE TSeasonPointer = ^TSeason
Declaration F
TYPE ProductRecord
DECLARE ProductID : INTEGER
DECLARE ProductName : STRING
DECLARE Price : REAL
DECLARE InStock : BOOLEAN
ENDTYPE
Declaration G
TYPE TSeason = (Spring, Summer, Autumn, Winter)
Declaration H
TYPE TNumberSet = SET OF INTEGER
DEFINE PrimeNumbers (2, 3, 5, 7, 11) : TNumberSet
Part 1 — Identify the Specific Type
Identify the specific type for each declaration. Choose from: Enumerated, Pointer, Record, Set.
Part 2 — Match Data to the Correct Data Type
Look at the following data examples. Identify the most appropriate user-defined data type to store each one.
Choose from: Enumerated, Pointer, Record, Set.
i. (Monday, Tuesday, Wednesday, Thursday, Friday)
ii. Data about a hospital patient including name, age, blood type and ward number
iii. A memory address that points to a REAL value
iv. (Red, Green, Blue, Yellow)
v. A collection of unique uppercase letters of the alphabet
vi. Data about a book including title, author, ISBN and price
Part 3 — Extended Writing
Answer the following questions in the space provided.
i. Explain the difference between a non-composite data type and a composite data type. Give one
example of each.
ii. State two differences between an enumerated type and a pointer type.
iii. A school wants to store the following data for each student: name, date of birth, year group, form
group, and whether the student is a prefect. Write pseudocode to define an appropriate record
structure.
Page 2 of 2