1.4.2 Data Structures Flashcards

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

What is an array?

A

An ordered, finite set of elements of a single type.

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

What type of array is a linear array?

A

A one dimensional array.

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

How do you visualise a two dimensional array?

A

You can visualise it as a spreadsheet/table.

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

How do you visualise a three dimensional array?

A

A three dimensional array can be visualised as a multi-page spreadsheet.

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

What is a record also known as?

A

A row in a file.

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

What is a record made up of?

A

A record is made up of files.

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

How can you identify a field from a record using programming?

A

recordName.fieldName

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

What is the definition of a list?

A

A data structure consisting of a number of items, where the items can occur more than once.

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

Where are the main differences between arrays and lists?

A
  • Lists can store data non-continuously whereas arrays store data in order,
  • Lists can store data of more than one data type.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a tuple?

A

An immutable, ordered set of values of any type.

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

What is the difference between a tuple and an array?

A

Tuple are initialised using regular brackets instead of square brackets.

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

What is a stack?

A

A last in first out data structure, where items can only be removed from and added to the top of the list.

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

Give an example of where stacks may be used.

A
  • Back button in a web page,

- Undo buttons.

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

What is a queue?

A

A first in first out data structure, where items are added to the end of the queue and remove from the front of the queue.

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

Stacks:

What does the operation isEmpty() do?

A

Checks to see if the stack is empty.

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

Stacks:

What does the operation push(value) do?

A

Adds a new value to the top of the stack.

17
Q

Stacks:

What does the operation peek() do?

A

Returns the top value of the stack without removing it.

18
Q

Stacks:

What does the operation pop() do?

A

Returns and removes the value at the top of the stack.

19
Q

Stacks:

What does the operation size() do?

A

It returns the size of the stack.

20
Q

Stacks:

What does the operation isFull() do?

A

Checks to see if the stack is full.

21
Q

Queues:

What does the operation enQueue(value) do?

A

Adds the value to the end of the queue.

22
Q

Queues:

What does the operation deQueue() do?

A

Removes the item from the end of the queue.

23
Q

Queues:

What does the operation isEmpty() do?

A

It checks to see if the queue is empty.

24
Q

Queues:

What does the operation isFull() do?

A

Checks to see if the queue is full.