5. Data Structures Flashcards

1
Q

What is a data structure?

A

A data structure is a set of related elements held in a computer’s memory.

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

What are some examples of data structures?

A
  • one dimensional arrays
  • two dimensional arrays
  • strings
  • records
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a static data structure?

A

When the size of the data structure is predetermined. This can be limiting as you need to know how large the data structure needs to be in advance, however it is easier to code as you always know how much space they’re going to take up.

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

What is a dynamic data structure?

A

A data structure that has no fixed size and can expand or shrink when needed.

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

What is an array?

A

A collection of data elements of the same data type grouped together under one identifier. They are static data structures.

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

Give an example of a 1 dimensional and a 2 dimensional array

A

One dimensional
declaring: Names = [“Sam”, “Lucy”, “James”]
calling: Names[1] would retrieve Lucy

Two dimensional
declaring: Names = [“Sam”, “Lucy”, “James”],
[“Peter”, “Sarah”, “Tom”]
calling: Names[1, 0] would retrieve Peter

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

What is a record?

A

A record is a set of items all related to a single entity. Records can contain more than 1 data type.

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