User-defined Data Types (Cambridge (CIE) A Level Computer Science): Flashcards

Exam code: 9618

1/28

0Still learning

Know0

  • Define user-defined data type.

Cards in this collection (28)

  • Define user-defined data type.

    A user-defined data type is a custom data type created by the programmer, built from existing types to match the specific needs of a program.

  • Name three things user-defined types let you do.

    Group related data under a single identifier, restrict a variable to a fixed set of valid values, and build dynamic data structures such as linked lists.

  • Define non-composite data type.

    A non-composite data type is a type defined without referencing another data type.

  • Define composite data type.

    A composite data type is one that references other data types in its definition, grouped under a single identifier.

  • What decides whether a type is composite or non-composite?

    Whether the type references other data types, not whether it holds one value or many.

  • Name the two non-composite user-defined types.

    Enumerated and pointer.

  • Define enumerated data type.

    An enumerated data type is a non-composite, user-defined type consisting of a list of all possible values the variable can take.

  • True or False?

    The values of an enumerated type are unordered.

    False.

    The values are ordered, with an implied sequence based on the order they are declared, so comparisons work.

  • Why does the order of values matter in an enumerated type?

    The values are ordered by the sequence in which they are declared, so comparisons work, for example Monday comes before Tuesday.

  • What is the pseudocode syntax for an enumerated type?

    TYPE <identifier> = (value1, value2, value3, ...)

  • Define pointer data type.

    A pointer is a non-composite, user-defined type that stores a memory address only, rather than the data itself.

  • What does a pointer definition also indicate?

    The type of data stored at that memory location.

  • What is the pseudocode syntax for a pointer type?

    TYPE <identifier> = ^<data type>

  • In pseudocode, the symbol          shows that a type is a pointer.

    In pseudocode, the symbol ^ shows that a type is a pointer.

  • What are pointers used to build?

    Dynamic data structures such as linked lists.

  • Name the three composite user-defined types.

    Record, set and class.

  • Define record as a composite type.

    A record is a composite type that groups a fixed number of related items (fields), which may be of different data types, into a single new type.

  • A record groups a            number of related fields under one identifier.

    A record groups a fixed number of related fields under one identifier.

  • How do you access a field of a record?

    Using dot notation, written as RecordName.FieldName.

  • Define set.

    A set is a composite type holding a list of unordered elements, where all elements must be of the same data type.

  • True or False?

    A set can hold elements of different data types.

    False.

    All elements must be of the same data type, and the set definition includes the data type it uses.

  • Which operations can be applied to a set?

    Set theory operations such as union and intersection.

  • What is the pseudocode syntax for declaring a set type?

    TYPE <identifier> = SET OF <data type>

  • Which keyword tests whether a value is in a set?

    ISIN

  • Define class as a composite type.

    A class is a composite type that groups together both data (attributes) and the methods that operate on that data, under a single identifier.

  • What is a class used as?

    A template to create objects in object-oriented programming.

  • Which user-defined type suits data that can only be one of a fixed, named list of values?

    An enumerated type.

  • Which user-defined type suits an unordered collection with no duplicates?

    A set.

Sign up to unlock flashcards

or