1
Q

What is abstraction?

A

It is the notion of retaining the releveant details for a given context and ignoring the irrelevant details.

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

What are simple/atomic data types?

A

These are data types that can be represented in data values which CANNOT be further divided.

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

What are examples of atomic data types?

A

Int
Str
Bool
Float

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

What are complex data types?

A

These are datatypes that represent collections of multiple data values

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

What are examples of complex data types?

A
Lists
Dictionaries
Tuples
Strings
Sets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are abstract data types (ADTs)?

A

These are complex data types which specifies a set of data values AND a set of operations that can be perfomed on these data values.

i.e. a function

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

What are characteristics of literal values?

A
  • They are objects

- As objects they require a certain amount of memory to hold data value

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

What are array-based structures?

A

The data items in this collection are organised and stored SEQUENTIALLY in a contigous block of memory.

Individual data items are located at the adjacent memory blocks.

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

How can you access data in an array-based data structure? Why does this method work?

A

Using indexing as the data is ordered.

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

What are link-based structures?

A

A data structure where the data items for a colection can be situated at ANY locations within memory.

The data items are linked together using the concept of ‘referencing’ the address of the subsequent item.

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

Can data in a link-based structure be accessed randomly?

A

No, since the data is not adjacent to each other in memory.

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

How can you access an item i in a link-based structure?

A

First you must begin at the first node, and traverse to the node that is linked to the initial node until reaching item i.

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

When are array-based structured preferred?

A

When the total number of elements in a data collection can be predetermined at the START of the program implementation.

When accesssing data elements at random.

This is due as array-based structures generally takes less memory compared to link-based structures at equal ‘fullness’.

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

When are link-based structured prefered?

A

If adding new elements and removing existing elements at random positions.

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

What is mutability?

A

It is the ability to modify an item.

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

What does it mean when an object is immutable?

A

This means that the object cannot be modified.

17
Q

Are string immutable or mutable?

A

Immutable.

18
Q

Are lists immutable or mutable?

A

Mutable

19
Q

What is an item assignment? Does it work for strings? Does it work for lists?

A

It is when you assign a variable to an item.

Only works for lists, not strings as strings are immutable.

20
Q

How would you replace an item in a string and return/print out the modified string?

A

Have to create a new variable which concatenates the item to be added and the index of where it should be added.

21
Q

Are tuples immutable or mutable?

A

Immutable

22
Q

What is aliasing?

A

When you assign two different names to the same object

23
Q

What is a dictionary?

A

It is a build it mapping data type in python. It assigns a value to a key. The value can then be accessed by determining the key.

24
Q

Are dictionaries unordered?

A

Yes