Chapter 16 Data Representation Flashcards

1
Q

user defined data type

A

A data type derived from one or more existing datatypes

used to extend the built-in datatypes
programmer’s requirement

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

why are user defined data types necessary

A

no suitable datatype is provided by the language used
if a programmer needs a specific datatype
that meets program requirements

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

non-composite datatype

A

single datatype that does not refer to another datatype
e.g: enumerated, pointer, real, string, char, boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

composite datatype

A

datatype that refers to other datatypes
data type is constructed from other datatypes
e.g: record, list, set, array, class, queue, linked list, dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

record

A

collection of related items which may be of different datatypes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

list

A

indexed collection that can contain different datatypes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

set

A

supports mathematical operation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

class

A

gives properties and methods for an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

array

A

collection of items of the same datatype

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

enumerated datatype

A

non-composite
defined by a given list of all possible values
in an order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

pointer datatype

A

non-composite
used to reference a memory location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

dereferencing

A

getting the value in an address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

record datatype

A

composite datatype
a collection of multiple datatypes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

declaring a range

A

0-89
DECLARE number : 0..89

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

file organization

A

Refers to the way data is stored in a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

serial file organization

A
  • Data is stored in chronological order
  • Easy to append data to the end of the file
  • Allows the data to be read in order of when they were taken
  • No KEY FIELDS need to be added
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

when is serial used

A
  • Suited to batch processing or for backing up data on a magnetic tape
  • When chronological order matters
    appending records
  • Small file, so easy to search
    when re-organizing as re-sorting is not required
  • Typical use is for a bank to record transactions
18
Q

sequential file organization

A
  • A method of file organization in which files are stored with ordered records
  • Records are stored in the order of the key fields
  • New records are inserted into their correct position
19
Q

when is sequential used

A
  • When there are unique fields, so it can be used for indexing
  • When it needs to be sorted in an order
  • When multiple records are required from one search of the file. Eg. Family history file where a search could be used for all records with a particular family name
20
Q

random file organization

A
  1. record location is calculated
    using a hashing algorithm on a key field, speed of data access is increased
  2. Can be used as lookup file
    if a record cannot be stored
    then subsequent location is searched (closed hash) or an overflow area is searched (open hash - chaining)
21
Q

hashing algorithm

A

a mathematical function to find a hash key to access data

22
Q

bucketing (closed hashing)

A

a method to deal with hashing collisions in which another empty space is found

23
Q

chaining (open hashing)

A

a method to deal with hashing collisions in which linked lists are used to find the location in ROM

24
Q

rehashing (closed hashing)

A

a method to deal with hashing collisions in which another algorithm is used

25
Q

how is sequential access used

A

earliest reading/data is accessed first
each successive reading is read
until final reading is accessed

26
Q

floating point representation

A

representation of real numbers

27
Q

mantissa

A

the significant digits of floating point number

28
Q

exponent

A

the power of base 2 (that the mantissa is raised to)

29
Q

normalization

A

a technique that is used to make your data more accurate

30
Q

random file

A

can be read/write at the same time
contains a collection of data
normally as records of a fixed length
can be thought of as having a file pointer that can be moved to any location or address of the file
record at that location can then be read or written

31
Q

Direct access file

A

Direct access can be done in two ways: Use a hashing algorithm OR Use a sequential file with a separate index file

  • In direct access, files using hashing, file access involves directly mapping the hashed key to a specific location in the file where the desired data is stored.
  • However, in cases of collision where multiple keys hash to the same location, serial searching within that location might be necessary to retrieve the correct data, potentially impacting direct access efficiency.
32
Q

When is direct access file used

A
  • Opt for a direct access file when quick access to specific data by its location or key is essential, offering faster retrieval and modification capabilities
  • An example is a system with many users
33
Q

Serial File Deletion

A

Deleting in a serial file typically involves marking the record as “deleted” without physically removing it to maintain
sequential order

34
Q

Sequential File Deletion

A

Data is transferred from the old file to a new one until the targeted record for deletion or modification is encountered, after which any changes are made, and the remaining records are then copied to the new file

35
Q

Direct Access File Deletion

A

Deleting in a direct access file involves marking the specific location as available, allowing it to be reused for new data

36
Q

Text file Versus Binary file (File organization)

A

Text file

  • Text file stores data in a human readable format according to a character code (ASCII, Unicode)

Binary file

  • A binary file stores data in a format that the computer can interpret directly as sequences of bytes. The organisation of a binary file is based on the concept of a record.
37
Q

Problems with using floating-point numbers

A
  • Approximation and Rounding Errors: Floating-point numbers involve approximations, and rounding errors can become significant during computations, particularly in repetitive operations. Accumulation of these small errors might lead to inaccuracies in the final result, especially in complex computations or numerical algorithms.
  • Limited Range of Numbers: Floating-point representation has a finite range to store numbers, resulting in limitations on both the minimum and maximum values that can be accurately represented. This limitation can lead to underflow errors when representing extremely small numbers, causing loss of precision or inaccuracies in calculations involving very small values
38
Q

Built-In Data Type

A

Built-in data types are predefined data types provided by a programming languag

39
Q

Enumerated data type Code snippet

A
40
Q

Pointer data type Code snippet

A
41
Q

Set Data Type Code snippet- Using set in Python to remove duplicated items in the list.

A
42
Q

Set Data Type Code snippet- Using set in Python to remove duplicated items in the list.

A