Chapter 7 Flashcards

1
Q

Lists and tables of values can be stored in _____ and _____.

A

arrays, collections

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

An array is a group of _____ (called elements or components) containing values that all have the same _____.

A

variables, type

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

The _____ allows you to iterate through an array’s elements without using a counter.

A

enhanced for statement

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

The number used to refer to a particular array element’s ______.

A

index (or subscript or position number)

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

An array that uses two indices is referred to as a(n) _____ array.

A

two-dimensional

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

Use the enhanced for statement ______ to walk through double array numbers.

A

for (double d : numbers)

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

Command-line arguments are stored in ______.

A

An array of Strings args

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

Use the expression ______ to receive the total number of arguments in a command line. Assume that command-line argments are stored in String[] args.

A

args.length

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

Given the command java MyClass test, the first command-line argument is ______.

A

test

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

A(n) ______ in the parameter list of a method indicates that the method can receive a variable number of arguments.

A

ellipsis(…)

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

(T or F) An array can store many different types of values.

A

False. An array can store only values of the same type.

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

(T or F) An array index should normally be of type float.

A

False. An array index must be an integer or an integer expression.

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

(T or F) Command-line arguments are separated by commas.

A

False. Command-line arguments are separated by white space.

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