chapter 6 book Flashcards

1
Q

In an array, each element has the same data type.

A

TRUE

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

Each array element is accessed using a subscript, which can be a number or a string.

A

FALSE

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

Array elements always occupy adjacent memory locations.

A

TRUE

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

You can use an array to replace a long series of decisions.

A

TRUE

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

You experience a major benefit of arrays when you use an unnamed numeric constant as a subscript as opposed to using a variable.

A

false

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

The process of displaying every element in a 10-element array is basically no different from displaying every element in a 100-element array.

A

true

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

If you create a named constant equal to an array size, you can use it as a subscript to the array.

A

false

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

If you create a named constant equal to an array size, you can use it as a limit against which to compare subscript values.

A

true

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

When you declare an array in Java, C#, or Visual Basic, a constant that represents the array size is automatically provided.

A

true

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

Only whole numbers can be stored in arrays.

A

false

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

Only whole numbers can be used as array subscripts.

A

true

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

A flag is a variable that indicates whether some event has occurred.

A

true

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

Parallel arrays must be the same data type.

A

false

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

Parallel arrays usually contain the same number of elements.

A

true

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

You can improve the efficiency of searching through parallel arrays by using an early exit.

A

true

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

To help locate a range within which a value falls, you can store the lowest value in each range in an array.

17
Q

When using an array to store range limits, you use a series of comparisons that would otherwise require many separate loop structures.

18
Q

Elements in an array frequently are different data types, so calculating the amount of memory the array occupies is difficult.

19
Q

If you attempt to access an array with a subscript that is too small, some programming languages will stop execution of the program and issue an error message.

20
Q

If you attempt to access an array with a subscript that is too large, some programming languages access an incorrect memory location outside the array bounds.

21
Q

The for loop is a particularly convenient tool when working with arrays because initializing, testing, and altering a loop control variable are coded together.

22
Q

You frequently need to process every element of an array from beginning to end in a linear fashion.

23
Q

One advantage to using a for loop to process array elements is that you need not be concerned with array bounds.