Comp Sci P3

Cards (156)

  • User-defined data type
    A data type based on an existing data type or other data types that have been defined by a programmer
  • Non-composite data type

    A data type that does not reference any other data types
  • Examples of non-composite data types
    • string
    • integer
    • real
    • date
    • char
    • Boolean
  • Enumerated data type
    A user-defined non-composite data type with an ordered list of all possible values
  • Pointer data type
    A user-defined non-composite data type used to reference a memory location
  • Set
    A given list of unordered elements that can use set theory operations such as intersection and union
  • User Defined Datatype
    • Constructed by the programmer
    • Derived from one or more datatypes
    • Used to extend built in datatypes
    • Created data types specific to programs
  • Purpose of User Defined Datatype
    • To extend flexibility of a program
    • To create new datatype from existing datatypes, or two create a new datatype that meets requirements of program
    • No suitable datatype available in programming language
  • Enumerated data type
    Contains no references to other data types when it is defined<|>Every single possible value for it is identified<|>The values defined in an enumerated data type are ordinal, meaning they have an implied order
  • Pointer data type
    Needs to have information about the type of data that will be stored in the memory location
  • Composite data types
    • Array
    • List
    • Records
    • Sets
  • Array
    Indexed Collection of items with same data type
  • List
    Indexed Collection of items that can have different data types
  • Records
    Collection of related data items which may have different data types
  • Sets
    Stores finite number of different values that have no order<|>Supports mechanical operations
  • Set data type
    • Collection of non-duplicate members, which are unordered and unindexed
    • Items are unordered and cannot be accessed with any index
    • Items are unchangeable, but new items can be added
    • Removes any duplicate members
  • Set operations
    • Checking if a value exists in a set
    • Adding a value
    • Removing an existing value
    • Set mathematical operations like union and intersection
    • Existing member (values) can't be altered
  • Class
    A composite data type that includes variables of given data types and methods (code routines that can be run by an object in that class)
  • Properties set to private
    To ensure properties can only be accessed by the class's own methods<|>To ensure they're hidden and encapsulated
  • Serial file organisation
    1. Records of data are physically stored in a file, one after another, in the order they were added to the file
    2. Data is appended to the end of file
    3. Stored in chronological order
  • Serial file organisation
    • Used for temporary files storing transactions to be made to more permanent files
    • Useful for simple data sets and configuration files
    • Unsorted transaction files
    • Text files
    • Mostly used for temporary files before moving data to permanent files
  • Deleting records in a serial file
    • Creates a gap
    • Can be encountered by copying the records except the one flagged for deletion into a new file, then replacing the old file with the new file
  • Changing records in a serial file
    Data cannot be changed without creating a new file, copying all the data across to the new file, and inserting the change at the appropriate point
  • Searching records in a serial file
    Start from the beginning of the file and search until the end
  • Sequential file organisation
    1. Records of data are physically stored in a file, one after another, in a given order
    2. Data is stored in order of a key field which uniquely identifies a record
    3. Can be stored in ascending or descending order
  • Sequential file organisation
    • Used for payroll processing
    • Used for processing of grades
  • Inserting records in a sequential file
    Copy the records up to the point where the new record needs to be inserted, insert the new record, then copy the remainder of the file
  • Random file organisation
    1. Records of data are physically stored in a file in any available position
    2. The location of any record in the file is found by using a hashing algorithm on the key field of a record
  • Random file organisation

    • Makes adding and removing data simpler
  • Hashing algorithm
    A mathematical formula used to perform a calculation on the key field of the record, the result of which gives the address where the record should be found
  • Sequential access
    A method of file access in which records are searched one after another from the physical start of the file until the required record is found
  • Direct access
    A method of file access in which a record can be physically found in a file without physically reading other records
  • When to use serial files
    • Data added to end of file
    • Stored chronologically
    • No need for sorting usually
    • If smaller file then it'll take less time for searching
  • When to use sequential files
    • Each customer has a unique account number
    • Sorted on account number
    • High hit rate
  • When to use random files
    • Fast data access
    • Low hit rate
    • No need to search through all records
  • Sequential access for serial files
    1. Every record needs to be checked until the required record is found or the whole file has been searched
    2. New records are appended to the end of the file
  • Sequential access for sequential files

    1. Every record needs to be checked until the record is found or the key field of the current record being checked is greater than the key field of the record being searched for
    2. New records are inserted in the correct place in the file
  • Serial file
    Every record needs to be checked until the record is found or the whole file has been searched and that record has not been found<|>Any new records are appended to the end of the file
  • Sequential file

    Every record needs to be checked until the record is found or the key field of the current record being checked is greater than the key field of the record being searched for<|>The rest of the file does not need to be searched as the records are sorted on ascending key field values<|>Any new records to be stored are inserted in the correct place in the file
  • Programs such as monthly billing or payroll system have a high hit rate during the processing as nearly every record is used when the program is run