16: Array Types Flashcards

(15 cards)

1
Q

A data type whose values are sequence of characters.

A

String

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

A homogenous collection of data in which each element is identified by its position in the collection.

A

Array

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

Pros and cons of string being primitive

A

more convenient, may operations are built in
implementation are more complex

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

Pros and cons of strings being array-of-char

A

Simpler implementation, closer to memory
More manual work, more error-prone

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

What are the valid values for array subscripts or indices?

A

if not whole number, returns undefined

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

The type of the subscript is usually bound ________.

A

statically

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

The range of the subscript is usually bound ________.

A

dynamically

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

Range is bound statically and storage allocation is done before run time

A

static array

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

pros and cons of static array?

A

p: more efficient since it does not require deallocation, no leak/dangling pointer from deallocation mistakes
c: less flexible

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

Range is bound statically but storage allocation is done when the declaration is elaborated

A

Fixed stack-dynamic array

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

Pros of fixed stack-dynamic array?

A

allows subprograms to share the same space when not in use

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

Range and storage are bound dynamically once elaborated

A

Stack-Dynamic Array

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

Range and storage are bound when program requests then during execution.

A

Fixed Heap-Dynamic Array

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

Array can grow and shrink during program execution

A

Heap-Dynamic Array

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

Two implementation-wise to map arrays in memory

A

Row major order, col major order

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