LOCH10 Quiz

Ace your homework & exams now with Quizwiz!

Each array variable must be declared in its own statement.

False

In an array, the first element is numbered 1.

False

It is important to remember the length of an array when working with it.

False

When an array is not full, one must replace the array's logical size with its physical length in the loop

False

The index of an array cell ranges from 1 to the length of the array minus 1

False, 0

An array with elements numbered 0 to 99 has a length of 99.

False, 100

Array variables are BLANK before they are assigned array objects.

False, Null

When setting up an array, you need to instantiate an array object and assign it to the array DECLARATION.

False, Variable

When referring to an array element, the method selector is ____. a. . c. [ ] b. { } d. < >

a. .

Alex is creating loops that iterate through an array of 500 integers called abc. Alex uses a(n) ____ variable to break out of a loop once the presence of a particular number is found in an array. a. Boolean c. string b. integer d. parameter

a. Boolean

An item's position in an array. a. Index b. Range c. Null d. Count e. Break

a. Index

The items in an array are called ____. a. elements c. variables b. values d. objects

a. elements

A(n) ____ loop visits each element in an array from the first position to the last position. a. enhanced for c. logical b. initializer d. parallel

a. enhanced for

Ravi is writing a program for a client that uses arrays. Ravi must indicate an array's ____ in the loop when the array is not full. a. logical size c. last value b. first value d. physical length

a. logical size

The simplest way to add a data element to an array is to ____. a. place it after the last available item c. increase the physical size b. place it before the first available item d. increase the logical size

a. place it after the last available item

A(n) ____________________ is a data structure consisting of an ordered collection of similar items.

array

Alex is creating loops that iterate through an array of 500 integers called abc. Alex is trying to find the first location of a value in the array. The variable loc initially equals ____. a. null c. 0 b. -1 d. 1

b. -1

A subscript of a value of -1 results in a(n) ____-bound error. a. Index b. Range c. Null d. Count e. Break

b. Range

The basic syntax for referring to an array ____ has the form <array name>[<index>]. a. length c. name b. element d. initializer

b. element

The Boolean variable ____ is used to break out of a loop if a particular number is in an array. a. break c. stop b. found d. true

b. found

To access the ____ cell in an array, use the expression <array>.length - 1 a. first c. second to last b. last d. None of the above

b. last

An array with 20 ints that receives 5 ints from interactive input has a(n) ____ size of 20. a. actual c. logical b. physical d. variable

b. physical

Failure to assign an array object can result in a(n) ____ pointer exception. a. Index b. Range c. Null d. Count e. Break

c. Null

When an array is instantiated, each cell is ____________________ until reset to a new object.

null

A(n) ____________________ is a loop that iterates through an array one element at a time.

transversal

An enhanced for loop is simpler to write then a standard for loop with an index.

True

For any particular array, all of the elements must be of the same type.

True

In order to set up an array, you need to declare an array variable.

True

Once an array is instantiated, its SIZE cannot be changed.

True

The JVM checks the values of subscripts before using them and throws an exception if they are out of bounds.

True

The detection of a range-bound error is similar to the JVM's behavior when a program attempts to divide by zero.

True

To have two variables refer to two separate arrays that happen to contain the same values, copy all of the elements from one array to the other.

True

In Figure 10-2 above, all of the following is true EXCEPT ____. a. The method changes the student's name to Bill. b. After the method finishes executing, the name is still Bill. c. The actual and formal parameters do not refer to the same object. d. Changes the method makes to the object's state are still in effect after the method terminates.

c. The actual and formal parameters do not refer to the same object.

When referring to an array element, the subscript operator is ____. a. . c. [ ] b. { } d. < >

c. [ ]

An array with 20 ints that receives 5 ints from interactive input has a(n) ____ size of 5. a. actual c. logical b. physical d. variable

c. logical

Arrays are ____ and must be instantiated before being used. a. values c. objects b. variables d. strings

c. objects

Ravi is writing a program for a client that uses arrays. Ravi uses ____ to indicate an initializer list. a. [ ] c. { } b. < > d. ( )

c. { }

This variable could be used to track the number of items input. a. Index b. Range c. Null d. Count e. Break

d. Count

An item's position within an array is called its ____. a. index c. path b. subscript d. both a and b are true.

d. both a and b are true

If you want to keep a list of peoples' names and ages, you can use two arrays in which corresponding elements are related by using ____ arrays. a. logical c. duplicate b. double d. parallel

d. parallel

When an object is used as a(n) ____ to a method, what gets passed is a reference to the object and not the object itself. a. variable c. initializer b. element d. parameter

d. parameter

Figure 10-1 above shows ____. a. two values referring to the same array variable b. an array with two strings of values c. an array with two names d. two variables referring to the same array object

d. two variables referring to the same array object

This statement can be used to terminate an enhanced for loop early. a. Index b. Range c. Null d. Count e. Break

e. Break

Arrays can be declared, instantiated, and initialized in one step. The list of numbers between the braces is called a(n) ____________________ list.

initalizer


Related study sets

Adult and Pediatric First Aid/CPR/AED

View Set

Intro to Computer Science Unit 1

View Set

International Business Midterm Exam

View Set

Spanish 1002- Indicativo vs. Subjuntivo

View Set

Tetracyclines, Macrolides, Clindamycin, Linezolid

View Set

Ch. 23- Learning: Vascular Disorders

View Set

Client with a spinal cord injury

View Set