Chapter 8: Arrays, Chapter 9: Advanced Array Concepts

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Languages such as Visual Basic, BASIC, and COBOL use ____ to refer to individual array elements.

( )

When you declare int[]someNums = new int[10];, each element of someNums has a value of ____.

0

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

2

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

3

int[][] myVals = {{2, 4, 6, 8}, {20, 40, 60, 80} }; Using the above two-dimensional array, what is the value of myVals[1][2]?

60

You use a ____ following the closing brace of an array initialization list.

;

You can add an item at any point in a(n) ____ container and the array size expands automatically to accommodate the new item.

ArrayList

____ is the process of arranging a series of objects in some logical order.

Sorting

Which of the following println statements will display the last myScores element in an array of 10?

System.out.println(vals[9]);

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

[ ]

When a method returns an array reference, you include ____ with the return type in the method header.

[ ]

When you declare or access an array, you can use any expression to represent the size, as long as the expression is _____.

an integer

When you place objects in order beginning with the object that has the lowest value, you are sorting in ____ order.

ascending

Programmers often refer to a ____ search as a "divide and conquer" procedure.

binary

A method that receives a two-dimensional array uses two ____ pairs following the data type in the parameter list of the method header.

bracket

In a(n) ____, you repeatedly compare pairs of items, swapping them if they are out of order, eventually creating a sorted list.

bubble sort

An ArrayList's ____ is the number of items it can hold without having to increase its size.

capacity

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

descending

Which Java statement creates a jagged array with six rows?

double [ ][ ] sales = new double[6][]

Which of the following statements correctly declares and creates an array to hold five double scores values?

double[] scores = new double[5]

A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable.

enhanced for

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

enum

In Java, boolean array elements automatically are assigned the value ____.

false

The length ____ contains the number of elements in the array.

field

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

fill

The Arrays class ____ method assigns the specified value to each element of the specified array.

fill()

A(n) ____ is a variable that holds a value as an indicator of whether some condition has been met.

flag

The ArrayList class ____ method retrieves an item from a specified location in an ArrayList.

get

In which of the following statements is the value of myVals null?

int [ ] myVals;

Which of the following statements correctly initializes an array with an initialization list?

int[ ] nums = {2, 4, 8};

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

int[ ][ ] someNumbers = new int[3][4];

When you declare or access an array, you can use any expression to represent the size, as long as the expression is a(n) ____.

integer

double[][] empSales = new double[5][]; The above statement declares a(n) ____ array.

jagged

With a two-dimensional array, the ____ field holds the number of rows in the array.

length

When mathematicians use a two-dimensional array, they often call it a ____.

matrix

If a class has only a default constructor, you must call the constructor using the keyword ____ for each declared array element.

new

When you create an array of objects, each reference is assigned the value ____.

null

When you declare an array name, no computer memory address is assigned to it. Instead, the array variable name has the special value ____, or Unicode value '\u0000'.

null

Regarding enumerations, the ____ method returns an integer that represents the constant's position in the list of constants; as with arrays, the first position is 0.

ordinal

A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.

parallel

The Arrays class ____ methods are a new feature in Java 8 that makes sorting more efficient when thousands or millions of objects need to be sorted.

parallelSort

Individual array elements are ____ by value when a copy of the value is made and used within the receiving method.

passed

Providing values for all the elements in an array is called ____ the array.

populating

When any ____ type (boolean, char, byte, short, int, long, float, or double) is passed to a method, the value is passed.

primitive

An instance variable or object field is also called a(n) ____ of the object.

property

When you perform a ____, you compare a value to the endpoints of numerical ranges to find the category in which a value belongs.

range match

The ArrayList class ____ method removes an item from an ArrayList at a specified location.

remove

After you create an array variable, you still need to ____ memory space.

reserve

It is a good programming practice to ensure that a subscript to an array does not fall below zero, causing a(n) ____.

runtime error

Comparing a variable to a list of values in an array is a process called ____ an array.

searching

An array that you can picture as a column of values, and whose elements you can access using one subscript, is a ____ array.

single-dimensional

The ArrayList class ____ method returns the current ArrayList size.

size

The negative integer returned by the binarySearch() method when the value is not found is the negative equivalent of the array ____.

size

The Arrays class ____ method sorts the specified array into ascending order.

sort()

When you initialize parallel arrays, it is convenient to use ____ so that the values that correspond to each other visually align on the screen or printed page.

spacing

A(n) ____ is an integer contained within square brackets that indicates one of an array's variables.

subscript

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

toString

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

type-safe

When any primitive type is passed to a method, the ____ is passed.

value

When any primitive type variable is passed to a method, the _____ is passed.

value


Set pelajaran terkait

Psychiatric Nursing Chapter 16: Depressive Disorders, Ch. 11 - Suicidal Thoughts and Behavior, Chapter 13 Neurocognitive disorder, Chapter 15: Schizophrenia and Other Psychotic Disorders NCLEX, Chapter 15: Schizophrenia Spectrum and Other Psychotic D...

View Set

Chapter 13; correlation and linear regression

View Set

practice questions for med surg II final

View Set

Sleep and Sleep Disorder Ch. 1-4

View Set