8 - Arrays Flashcards

1
Q

An array

A

is a simple but powerful programming language construct use to group and organize data.

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

An array of size N is indexed…

A

from 0 to N-1.

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

In Java, an array is an object …

A

that must be instantiated.

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

Int[ ] (type of array) height (name of array) =

A

new int[11] (size of array)

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

Automatic bounds checking

A

ensures that the index is in range for the array being referenced.

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

Int[ ] grades is better than

A

Int grades [ ] but both are acceptable

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

An initializer list can be used to instantiate an array object instead of using the new operator.

A

Int [ ] scores = {12, 13, 14, 15} (this array would have a size of 4)

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

An entire array can be passed as a parameter, making the formal parameter an alias of the original.

A

(**** NEED EXAMPLE **)

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

Instantiating and array of objects reserves…

A

room to store references only. The objects that are stored in each element much be instantiated separately.

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

Command-line arguments are stored in…

A

an array of String objects and are passed to the main method.

Example public static void main(String[ ] args)
Command line accessed through args [0]

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

A java method can be defined to accept a varying number of parameters.

A

Example public void test(int count, String name, double . . . nums)

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

Int [ ] [ ] table = new int510

A
(multi-dimensional array)
	1 2 3 4 5 6 7 8 9 10
	2
	3
	4
	5
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Using an array with more than two dimensions …

A

is rare in an object-oriented system.

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