Chapter 7 Quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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

True

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

True

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

True

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

True

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

add

The Java compiler will display an error message when it processes a statement that uses an invalid subscript.

False

The for-each loop is designed to let you look at both the values in an array and their indexes.

False

Given the following two-dimensional array declaration, which statement is true? int[][] numbers = new int[6][9];

The numbers array has 6 rows and 9 columns.

The sequential search algorithm

uses a loop to sequentially step through an array, starting with the first element

The binary search algorithm

will cut the portion of the array being searched in half each time it fails to locate the search value.

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

import java.util.ArrayList;

If numbers is a two-dimensional array, which of the following would give the number of columns in row r?

numbers[r].length

Which statement would put the array "nums" into ascending order?

Arrays.sort(nums);

When an array is passed to a method

it is passed just as any other object would be passed.

Which of the following is a correct method header for receiving a two-dimensional array as an argument?

public static void passMyArray(int[][] myArray)

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

remove

You can use the ________ method to replace an item at a specific location in an ArrayList.

set

Which method is used to determine the number of items stored in an ArrayList object?

size

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

subscript

In order to do a binary search on an array

the array must first be sorted.


संबंधित स्टडी सेट्स

WEEK 3:: PYTHON AUTOMATION REGEX(REGULAR EXPRESSION)

View Set

Community/ Public Health Theory Exam 1 Review Questions

View Set

PrepU chapter 17- upper respiratory tract

View Set

Musculoskeletal Pharmacology Quiz

View Set

ATI Chapter 21: Medications for Anxiety and Trauma-and Stressor-Related Disorders

View Set

Section 7: System Development Life Cycle

View Set

115 PrepU Ch. 21 Assessment of Cardiovascular Function

View Set

فيزياء الفصل الثانى

View Set