Exam 9: Advanced Array Concepts

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

How would you create an array named someNumbers that holds three rows and four columns?

Free
(Multiple Choice)
5.0/5
(49)
Correct Answer:
Verified

B

Declare an ArrayList that declares a list of strings with a capacity of 20.

Free
(Essay)
4.8/5
(36)
Correct Answer:
Verified

ArrayList names = new ArrayList (20);

int[][] studentScores = {{70, 82, 90, 68}, {95, 75, 67, 89}, {98, 79, 57, 81}}; Using the above two-dimensional array, what is the value of studentScores[0][0] ? What is the value of studentScores[2][3] ? What is the value of studentScores[1][2] ? Describe how arrays reference values with subscripts.

Free
(Essay)
4.8/5
(43)
Correct Answer:
Verified

studentScores[0][0] = 70
studentScores[2][3] = 81
studentScores[1][2] = 67
The value within the first set of brackets following the array name refers to the row.
The value within the second set of brackets refers to the column. Rows and columns begin with a value of 0.

To declare a two-dimensional array in Java, you type two sets of ____ after the array type.

(Multiple Choice)
4.9/5
(34)

int[][] myVals = {{2, 4, 6},  {1, 8, 9},  {1, 3, 5, 7}}; Using the above array, what is the value of myVals[1].length ?

(Multiple Choice)
4.8/5
(33)

The ArrayList class ____ method returns the current ArrayList size.

(Multiple Choice)
4.7/5
(32)

When using an insertion sort, each list element is examined one at a time and moved down if the tested element should be inserted before them.

(True/False)
4.8/5
(44)

Write the statement to declare a three-by-four array of integers with the elements initialized to zero. Name the array myArray .

(Short Answer)
4.8/5
(33)

Regarding enumerations, the ____ method returns the name of the calling constant object.

(Multiple Choice)
4.9/5
(41)

Which of the following describes a data type for which only appropriate behaviors are allowed?

(Multiple Choice)
4.8/5
(36)

In Java, you create an enumerated data type in a statement that uses the keyword ____.

(Multiple Choice)
4.7/5
(28)

What are some of the advantages of the ArrayList class over the Arrays class?

(Essay)
4.9/5
(46)

Describe how to visualize the following array. How would you identify the location of the 99 that is stored in the array? int[][] someNumbers = {{8, 9, 10, 11}, {1, 3, 12, 15}, {5, 9, 44, 99} };

(Essay)
4.8/5
(47)

The Arrays class ____ method puts a particular value in each element of the array.

(Multiple Choice)
4.9/5
(33)

int[][] myVals = {{10, 15, 20, 25},  {30, 35, 40, 45, 50, 55, 60},  {65, 70, 75, 80, 85, 90}}; Using the above array, what is the value of myVals.length ? What is the value of myVals[1].length ? What is the value of myVals[2].length ? Explain how you determined these values.

(Essay)
4.7/5
(39)

Since the Arrays class is part of the java.util package, you can use the java.util.*; import statement to access it.

(True/False)
4.9/5
(25)

When working with two-dimensional arrays, the length field holds the number of rows in an array and each row has a length field that holds the number of columns in the row.

(True/False)
4.8/5
(32)

When you start with the object that has the largest value, you are sorting in ____________________ order.

(Short Answer)
4.9/5
(36)

How can you pass a two-dimensional array to a method? Provide some examples.

(Essay)
4.8/5
(29)

Write the statement that assigns the integer value 20 to the first column of the first row of an array named myVals .

(Short Answer)
4.7/5
(37)
Showing 1 - 20 of 66
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)