Composite User Defined Data Types Flashcards
State what is meant by a composite user defined data type
With reference to at least one other type of data type
Give examples of composite user-defined data types
Record Data Type, Set Data Type, Objects and Classes, Arrays (same data type)
State what is meant by a record data type
A data type that contains a fixed number of components which can be of different types. (It is the most useful)
Write the pseudocode for a record data type.
TYPE TEmployeeRecord DECLARE FirstName: String DECLARE LastName: String DECLARE DOB: Date DECLARE Salary: Currency ENDTYPE
Write the pseudocode to access an individual data item
Using dot notation…
Employee1.DOB
State how records are normally implemented as a data structure
Where one or two of the variables are defined as pointer variables
State what is meant by Set Data Type
Allows a program to create sets and to apply mathematical operations defined in set theory
State the list of operations that are defined in Set Theory
Union Difference Intersection Include element in the set Exclude element from set Check if element is in a set
State what is meant by Objects and Classes
In Object Oriented programming, a program defined the classes to be used (which are all user defined data types). For each class the objects must be defined. Uses properties and methods.
Explain why are user defined data types necessary?
It will make large programs more understandable and less error-prone. Once the programmer has decided of this advantage to use a data type that is not one of the built in types, then user definition is inevitable.
You could use an integer variable for a program which is the same for all programs- however there cannot be a built-in record type because each different problem will need an individual definition of the record