13 Data Representation

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

Define UDT [3]

  • to create a new data type

  • to allow construction of data types not available in a programming language

  • constructed by the programmer

2
New cards

Explain Composite data types [3]

  • collection of data that consists of elements of the same or different data types grouped under a singular identifier

  • can be user-defined or primitive

  • includes records, sets, class/object

3
New cards

Explain non-composite data types and give the 2 types [4]

  • can be defined w/out referencing another data type

  • contains only one data type in their definition (can only hold one kind of data)

  • can be user-defined or a primitive data type

  • enumerated data types and pointer data types

4
New cards

Explain enumerated data types and give an example

  • has an ordered list of possible values

TYPE Tratings = (worst, bad, ok, good, great)

DECLARE RatingOne, RatingTwo: Tratings

RatingOne ← worst

RatingTwo ← RatingOne + 1

5
New cards

Explain pointer data types and give an example [4]

  • used to reference a memory location

  • stores addresses/ memory locations

  • indicates the type of data stored in the memory location

TYPE Tratingpointer = ^Tratings

DECLARE ratingpointer = Tratingpointer

ratingpointer ← ^RatingOne

6
New cards

State the 3 file organisation methods

Serial Files, Sequential Files, Random Filesand Indexed Files.

7
New cards

Explain serial files [3]

  • records are stored and accessed one after another

  • new records are added in the next available space — records are appended to file

    • when searching — every record needs to be checked until the record is found or all has been checked

8
New cards

Explain sequential files [5]

  • files are stored and addressed one after another

  • a new version of the file has to be created to update it

  • files are stored with ordered records — records are stored in order of the key field

  • new records are inserted in the correct position

    • when searching — the key field is compared and every record is checked until it is found, or the key field of a current record is greater than the one being searched for

9
New cards

Explain random fields [3]

  • records are stored in no particular order within the file (there is no sequencing)

  • there is a relationship between the record key and its location within the file — the location of the record is found using a hashing algorithm

    • updates to the file can be carried out directly

10
New cards

What are the 2 types of file accessing methods and which file organization applies to them

Sequential Access Process and Direct Access

11
New cards

Explain Sequential access process [3]

  • records are checked linearly until desired record is found/ EOF reached

  • starts searching for records one after the other from the start of file until record found/ EOF reached

    • most suitable when data is stored in a certain order based on a field — eg. bank stored data records in ascending order of account number

12
New cards

Explain Direct file accessing and explain respectively for the 2 types of files it applies to [5]

  • most suitable when a record is referenced by a unique address

  • allows a record to be found in a file w/out other records being read — records are found by using the key field of the target record (the record’s location is found using hashing algorithm)

sequential files

  • an index of all key fields is kept — the index is searched for the address of the file location where the target record is stored

random files

  • a hashing algorithm is used on the key field of the record to calculate address of the memory location where the target record is expected to be stored

    • linear probing or search overflow can be used to find a record if it is not a expected location

13
New cards

enumerated data type

self defined data types

14
New cards

pointer data type

used to find addresses of data