Data Representation (A Level)
Advanced data representation concepts for A2 level.
Topics
- Floating Point Representation
- User-defined Data Types
- File Organisation
Key terms
13.1 User-defined data types
- Non-composite data type
- A user-defined type that is defined without referring to other types, such as an enumerated type or a pointer type.
- Enumerated type declaration
- Lists every allowed value, for example TYPE TDay = (Mon, Tue, Wed). It limits a variable to a meaningful set of values.
- Pointer declaration
- Creates a type that holds a memory address, for example DECLARE p : ^INTEGER.
- Dereferencing a pointer
- Using a pointer to reach the value stored at the address it holds.
- Set type
- A collection of values with no repeats and no particular order, supporting operations such as union and intersection.
13.2 File organisation and access
- Key field
- The field in a record used to identify it and to decide where it is stored.
- Serial file organisation
- Records are stored one after another in the order they were added, with no sorting.
- Sequential file organisation
- Records are stored in order of their key field.
- Direct (random) access file
- Records are stored at an address worked out from the key field, so any record can be reached without reading the others.
- Sequential access
- Reading records one by one from the start of a file until the wanted one is found.
- Indexed sequential file
- A sequential file with a separate index, allowing both sequential and faster direct access.
- Hashing algorithm (file access)
- A calculation that turns a record's key into the address where the record is stored.
- Hash collision
- Two different keys producing the same address when hashed.
- Linear probing
- Resolving a collision by trying the next addresses in turn until an empty one is found.
- Overflow area
- A separate part of a file where records that collide are stored, linked by pointers.
13.3 Floating-point numbers
- Floating-point number
- A real number stored in two parts, a mantissa and an exponent, like scientific notation.
- Mantissa
- The part of a floating-point number that holds its significant digits.
- Exponent
- The part of a floating-point number that gives the power of 2 the mantissa is multiplied by.
- Normalisation (floating-point)
- Adjusting the mantissa and exponent so the mantissa starts 01 (positive) or 10 (negative), giving the most precision for the bits available.
- Precision
- How accurately a number can be stored. More bits for the mantissa gives greater precision.
- Range
- How large or small a number can be. More bits for the exponent gives a wider range.
- Rounding error
- Inaccuracy caused by storing a real number using a limited number of bits.
- Floating-point overflow
- The exponent needed is too large to store, so the number cannot be represented.
Practice questions for Data Representation (A Level)