Exam 7: Arrays and the Arraylist Class

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

For the following code, what would be the value of str[2]? String[ ] str = {"abc", "def", "ghi", "jkl"};

Free
(Multiple Choice)
4.7/5
(84)
Correct Answer:
Verified

A

The binary search algorithm

Free
(Multiple Choice)
4.9/5
(91)
Correct Answer:
Verified

B

What would be the result of executing the following code? int[ ] x = {0, 1, 2, 3, 4, 5};

Free
(Multiple Choice)
4.8/5
(80)
Correct Answer:
Verified

B

A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order.

(True/False)
4.7/5
(75)

A search algorithm

(Multiple Choice)
4.9/5
(76)

When an array of objects is declared but not initialized, the array values are set to 0.

(True/False)
4.9/5
(83)

A(n) __________ is used as an index to pinpoint a specific element within an array.

(Multiple Choice)
4.7/5
(86)

The String[ ] args parameter in the main method header allows the program to receive arguments from the operating system command-line.

(True/False)
4.8/5
(79)

Which of the following ArrayList class methods is used to insert an item at a specific location in an ArrayList?

(Multiple Choice)
4.9/5
(84)

What will be the result after the following code is executed? final int ARRAY_SIZE = 5; Float[ ] x = float[ARRAY_SIZE]; For (i = 1; i <= ARRAY_SIZE; i++) { X[i] = 10.0; }

(Multiple Choice)
4.8/5
(79)

An ArrayList object automatically expands in size to accommodate the items stored in it.

(True/False)
4.7/5
(78)

Which of the following import statements is required in order to use the ArrayList class?

(Multiple Choice)
4.9/5
(72)

A partially filled array is normally used

(Multiple Choice)
4.8/5
(71)

Any items typed on the command-line, separated by space, after the name of the class, are considered to be one or more arguments that are to be passed into the main method.

(True/False)
4.9/5
(77)

To determine if two arrays are equal you must compare each of the elements of the two arrays.

(True/False)
4.8/5
(77)

The __________ method removes an item from an ArrayList at a specific index.

(Multiple Choice)
4.8/5
(76)

When an array is passed to a method

(Multiple Choice)
4.9/5
(74)

Java provides a mechanism known as a __________ which makes it possible to write a method that takes a variable number of arguments.

(Multiple Choice)
4.8/5
(84)

Objects in an array are accessed with subscripts, just like any other data type in an array.

(True/False)
4.9/5
(89)

What does the following statement do? double[ ] array1 = new double[10];

(Multiple Choice)
4.8/5
(58)
Showing 1 - 20 of 40
close modal

Filters

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