Arrays Flashcards

1
Q

What does an array represent?

A

Arrays represent a collection of data.

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

Is an array a value type or reference type?

A

Reference type

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

How do I know how many elements are in an array?

A

A single array variable can track any number of individual data items. It’s only limited by the computer’s memory.

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

How do I know how many elements an array could hold?

A

By the int in the square brackets or by .length();

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

How do I access an element in an array?

A

Through the array’s index.

Ex: System.out.println(planets[1]);

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

If an array holds ten elements, what happens if I try to access the 12th element?

A

An index that is greater than or equal to the length of the array will cause a run-time failure. A negative index will causes a run-time failure.

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

Are array elements value or reference types?

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