Data structures and abstract data types Flashcards

1
Q

Define primitive data type and give an example

A

They can only contain one data value. e.g. Integer, Boolean, Real etc

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

Define composite/compound data type and give an example

A

They’re built by combining primitive data types e.g. Records, Class

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

Define data structures

A

A collection of data that is organised to allow efficient processing. This means a wide range of sorting algorithms can be used

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

Define abstract data types

A

A conceptual model that describes how data is organised and which operations can be carried out from the perspective of an end user with no background knowledge

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

How do static data structures deal with memory?

A

They reserve enough memory for a set amount of data established in advance. The structure can not be resized

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

How are static data structures efficient and inefficient?

A

They’re very memory efficient as they can access elements directly by index.
They’re inefficient if the wrong amount of memory is allocated leading to wastage or errors

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

How do dynamic data structures deal with memory?

A

The memory capacity is not fixed and the number of elements it can hold is only limited by the memory allocation for the whole program

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

Name an advantage and disadvantage of dynamic data structures

A

Advantage is that the memory size is not pre set

A disadvantage is that elements can not be accessed directly- only by memory location which is sequential

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

What is a memory heap?

A

The amount of memory allocated to a program at run time that data structures can access

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

Definition of an array

A

A data structure that holds a number of elements of the same data type

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

How are arrays declared & processed?

A

Declared under a single identifier and processed efficiently using iteration techniques

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

How do arrays use indexes?

A

Each position is identified by an index, usually using zero-based indexing. Data is stored contiguously( next to each other) in main memory so each position is directly acessible

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

Are the values in an array mutable?

A

Yes, they can be changed while the program is running

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

What are the three steps to declaring a one dimensional array?

A

Create an identifier
Specify the data type of the elements
Specify the number of positions in the array

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

What’s another name for a 2D array?

A

A Matrix

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

What 2 values do you need to access an element in a 2D array?

A

A column index and a row index

17
Q

Define a record

A

A data structure which consists of a fixed number of variables called fields

18
Q

What does every field have to have?

A

A field name (Identifier) and a data type

19
Q

Name a simple way of storing data

A

Text files