Chapter 7 Arrays Flashcards

1
Q

7.1 Arrays can hold ____ _____.

A

Multiple values

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

7.1 How are the values in arrays stored?

A

The values are stored together in consecutive memory locations.

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

7.1 int days[6];

A

This is a definition of an array of integers.

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

7.1 How many elements can this array store?
int days[6];

A

6

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

7.1 An array’s size declarator must be?

A

A constant integer expression with a value greater than 0.

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

7.1 Arrays can either be a literal (EX: int days[6];), or?

A

Named constants.
EX: const int NUM_DAYS = 6;
int days [NUM_DAYS];

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

7.1 The amount of memory used by an array depends on?

A

Depends on the array’s data type and the number of elements.

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

7.1 The size of an array can be calculated by?

A

By multiplying the size of an individual element by the number of elements in the array.

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

7.2 What is a subscript?

A

A number that is assigned to each element in an array.

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

7.2 What is the use of a subscript?

A

A subscript is used as an index to pinpoint a specific element within an array.

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

7.2 Subscript numbering starts at what number?

A

Subscript numbering in C++ always starts at 0.

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

7.2 May array elements be used with the cin and cout objects like any other variable?

A

Yes

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

7.2 Storing subscript numbers in variable makes it possible to do what?

A

Makes it possible to use a loop to “cycle through” an entire array, performing the same operation on each element.

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

7.3 Does C++ perform array bounds checking?

A

In order to increase runtime efficiency, C++ does not perform array bounds checking.

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

7.3 In working with arrays, what is a common type of mistake?

A

Off-by-one error.

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

7.4 When arrays are defined, they may be?

A

Arrays may be initialized when they are defined.

17
Q

7.4 The series of values inside the braces and separated with commas is called?
EX: {1, 2, 3, 4, 5, 6}

A

An initialization list.

18
Q

7.4 When an array is being initialized, C++ requires a value for every element. True or false?

A

False.
It’s possible to only initialize part of an array.

19
Q

7.4 If an array is being partially initialized, the uninitialized elements will be set to?

A

Zero

20
Q

7.4 What is implicit array sizing?

A

Defining an array without specifying its size, as long as you provide an initialization list.

21
Q

7.5 What is the range-based for loop?

A

A specialized version of the for loop. It’s a loop that iterates once for each element in an array. Every time the loop iterates, it copies an element from the array to a variable.

22
Q

7.5 Range-based for loop was introduced in what version of C++?

A

C++ 11