16 - Data Types: Array Types Flashcards

(19 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

pros of primitive strings (2)

A
  1. more convenient
  2. many operations are built-in
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

cons of primitive strings

A

implementation is more complex

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

pros of array-of-char strings (2)

A
  1. simpler implementation
  2. closer to memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

cons of array-of-char strings (2)

A
  1. more manual work
  2. more error-prone
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

design issues of array types (7)

A
  1. subscript types
  2. range checking
  3. binding of subscript type and range
  4. storage binding
  5. initialization
  6. row length
  7. array slices
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

is arr[5.26] a valid array subscript?

A

yes (in javascript), but returns undefined

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

the type of the subscript is usually bound [statically/dynamically]

A

statically

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

the range of valid subscripts is usually bound [statically/dynamically]

A

dynamically

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

arrays differ in __ and __

A

when their size is known,
where they live in memory

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

on array categories:

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
12
Q

on array categories:

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
13
Q

on array categories:

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
14
Q

on array categories:

range and storage are bound when the program requests them during execution

A

fixed heap-dynamic array

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

on array categories:

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
16
Q

rectangular or ragged array?

  • each row has the same column size
  • each column has the same row size
A

rectangular array

17
Q

rectangular or ragged array?

the number of columns for each row need not to be the same

18
Q

row or col major order?

array is stored by rows

A

row major order

19
Q

row or col major order?

array is stored by cols

A

col major order