COSC 1437 CH7

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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

All of these

When an array is passed to a method

All of these

Which of the statements are true about the following code? final int ARRAY_SIZE=10; long[] array1 = new long [ARRAY_SIZE];

All of these

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

An array of 6 values, ranging from 0 through 5 and referenced by the variable x, will be created.

A sorting algorithm is used to locate a specific item in a larger collection of data.

False

What does <String> specify in the following statement?

It specifies that only String objects may be stored in the ArrayList object.

What will be the result of the following code? numbers[i]<value

The value variable will contain the lowest value in the numbers array.

What will be the result of the following code? int[] numbers = {50,10,15,20,25,100,30}; int value = 0; value += numbers[i];

The value variable will contain the sum of all the values in the numbers array.

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

Java does not limit the number of dimensions that an array may have.

True

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

True

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

True

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

numbers[r].length

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

You use this method 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 in ascending order.

This method returns a string representing all of the items stored in an ArrayList object.

toString

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

variable-length argument lists

The binary search algorithm

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

To return an array of long values from a method, use this as the return type for the method.

long[]

A partially filled array is normally used

with an accompanying integer value that holds the number of items stored in the array.

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

True

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

True

An array of String objects

consists of an array of references to String objects.

You can use this ArrayList class method to insert an item at a specific location in an ArrayList.

add

Given the following two-dimensional array declaration, which statement is true?

The numbers array has 6 rows and 9 columns.

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

True


Ensembles d'études connexes

NATIONAL PORTION CONTRACTS SUBTOPICS

View Set

NUR 1030 LAB Asepsis AND INFECTION CONTROL

View Set

Google Machine Learning Certification

View Set

Chapter 13 Review Test 5 Gastrointestinal Tract

View Set

Chapter 30: Atraumatic Care of Children and Families

View Set

Comprehensive Interdisciplinary Assessment (CIA) and Plan of Care (POC)

View Set