1.5 Data Structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is an array?

A

An array is a static data structure that contains variables of the same data type grouped together and each element is referenced by an index.
They can be multidimensional and are random access

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

What does random access mean?

A

That if you pick any part of the data structure, you get fetch it in the same amount of time

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

How would you find and print the contents of an index in a 1D and 2D array in python?

A

1D
arrayName[row] e.g. subjects[1] = “maths”

2D
arrayName[row][column] e.g. subjects[2][1] = Mrs Lane

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

What is a record?

A

A dynamic data structure where the items are referred to by field names instead of an index and the item’s can have different data types. Each field contains different pieces of information about a subject (e.g. a person or building)

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

What are fixed length records?

A

Records where each piece of data in each field will be allocated a certain number of bits which can’t be exceeded. If the data is less than the number of bits, there will be blanks.

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

What are variable length records?

A

Records where each piece of data will be given the exact amount of bits needed to be stored

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

What are the advantages and disadvantages of both fixed and variable length records?

A

Fixed length records
+ The length of each record is known meaning they are easier to manipulate when programming
- Can take up a large amount of space from empty bits
- You can’t go over the limit so some data cannot be inputted

Variable length records
+ They save a lot of storage space
+ Any length data can be inputted into the record
- Can be complicated to manipulate through code as the length is unknown

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