Arrays Flashcards

1
Q

Declare an array named scores of twenty-five elements of type int .

A

int scores[25];

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

Describe what is an array

A

A collection of contiguous or adjacent memory cells associated with one variable name and one type
An array is considered a data structure

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

In C++, the array index begins at…

A

position 0

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

range of array index values

A

Index values must be between 0 and (array size -1)

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

How to initialize an array during declaration

A

Place the initializing values in braces. Example:

double sales[5] = {12,32,16,23,45};

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

To copy, read, or compare arrays, it must be done…

A

componentwise

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

2d ARRAYS

A

myarray[row][collums]

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

What are parallel arrays used for?

A

To hold related information.

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

How do you access an element of a two-dimensional array?

A

You need a pair of indices: one for the row position and one for the column position.

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

When declaring a two-dimensional array as a formal parameter, what can you omit?

A

The size of the first dimension but not the second.

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

What is the difference between a size declarator and a subscript?

A

The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element in an array.

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

C++ has no array _________ checking, which means you can inadvertently store data past the end of an array.

A

Bounds

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

reference the 10th position of the array my array

A

n=myarray[10]

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