Skip to content

9618 · 13.1

User-defined data types flashcards

Revision flashcards for Cambridge 9618 User-defined data types (syllabus 13.1). Flip, recall, then mark a real past-paper question.

  • Card

    What is a user-defined data type?

    A data type that is defined by the programmer, rather than being a built-in (primitive) type. It is derived from existing data types.

  • Card

    What is a composite data type?

    A data type that is constructed from a collection of other data types, which can be different from each other. A record is a key example.

  • Card

    What is the pseudocode keyword to begin defining a new data type?

    `TYPE`. For example, `TYPE TStudent`.

  • Card

    What is the pseudocode keyword to end a data type definition?

    `ENDTYPE`.

  • Card

    What is a 'field' in the context of a record?

    A single data item within a record structure. It has a name (identifier) and a specific data type. Also known as a member.

  • Card

    How do you declare a variable of a user-defined type named `TPerson`?

    `DECLARE MyPerson : TPerson`. The type name follows the colon.

  • Card

    What is dot notation used for?

    To access a specific field within a variable of a record type. Syntax: `VariableName.FieldName`.

  • Card

    What is an enumerated data type?

    A user-defined type that consists of a set of named integer constants. For example, `TYPE TDay = (Monday, Tuesday, Wednesday, ...)`.

  • Card

    Can a record contain an array?

    Yes. A field within a record can be an array. For example, `TestScores : ARRAY[1:5] OF INTEGER` could be a field inside a student record.

  • Card

    What is a common mistake when defining a record type?

    Forgetting to declare the data type for each field inside the `TYPE` definition, or forgetting the `ENDTYPE` keyword.

  • Card

    What is a pointer type?

    A user-defined type that holds a memory address. The address points to a location where a piece of data is stored. It's defined using the `^` symbol, e.g., `TYPE NodePointer = ^ListNode`.

  • Card

    Why are user-defined types better than using parallel arrays?

    They group logically related data together, improving code readability and maintainability. It ensures that data for a single entity (like a person) is treated as a single unit, reducing the risk of data mismatch errors.