Chapter 7 Flashcards

1
Q

what is an array used for?

A

storing multiple values of the same type

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

how can you access an element of an array?

A

by using an index

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

what is the syntax of an array?

A

element type arrayName [SIZE]

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

the size of an array must be a ______

A

constant

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

array indicies are are ____ based

A

zero

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

what us the syntax for an element in an array?

A

arrayName [index]

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

what is the syntax for a array intializer?

A

elementType arrayName [arraySize] = {value0, value1,…valuek};

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

when using an array initializer can you declare and initialize in more than one statement?

A

no. splitting declaration and and initialization causes a syntax error

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

can you omit the array size when initializing an array?

A

yes. c++ will figure out how many elements there are in the array

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

if you wan to initialize an array, do you have to initialize every number in the array?

A

no, but all the other number will be set to zero

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

since the size of the array is known it is common to use a ____ loop

A

for

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

if you have to arrays, list and mylist, can you copy mylist to list like such?
list = my list

A

no just must copy the individual elements from one array to the other

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