Chapter 8 Flashcards

1
Q

An array is a list of data items that all

A

have the same type.

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

When you declare an array

A

You might reserve memory for it in the same statement.

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

For how many integers does the following statement reserve room? int[] values = new int[34];

A

34 integers

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

Which of the following can be used as an array subscript? Char, String, double, int.

A

Int

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

If you declare an array as follows, how do you indicate the final element of the array?
Int[] nuns = new int[6];

A

Nums[5]

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

Int[] nums = {101, 202, 303, 404, 505, 606};
What is the value of nums[2]?

A

303

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

When you initialize an array by giving it values upon creation, you

A

Do not explicitly give the array a size

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

In Java, you can declare an array of 12 elements and initialize

A

All of them

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

You can assign the value 100 to each element in the array declared by
Int[] nums = new int[4];

A

For(x<0; x<4; ++x) nums[x]=100;

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

What is the value of creditScores.length in the following array?
Int[] creditScores = {670, 720, 815};

A

3

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

A parallel array is one that

A

Holds values that correspond to those in another array

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

When you pass an array element to a method, the method receives

A

A copy of the value in the element

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

A single array element of a primitive type is passed to a method by

A

Value

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

When you pass an array to a method, the method receives

A

The address of the array

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

When you place objects in order beginning with the object with the highest value, you are sorting in _____ order.

A

Descending

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

Using a bubble sort involves comparing each array element with

A

The adjacent element

17
Q

The following defines a _______ array.
Int [] [] nums = { {1,2}, {3,4}, {5,6} };

A

Two-dimensional

18
Q

Double [] [] prices = { {1,2,3,4}, {5,6,7,8} };
How many rows are contained in the following array?

A

2

19
Q

Char[] [] codes = { {‘A’, ‘D’, ‘M’}, {‘P’, ‘R’, ‘S’}, {‘U’, ‘V’, ‘Z’} };
What is the value of codes [2][1];?

A

‘V’

20
Q

The methods in the array class

A

Are static methods