Exam 8: Arrays

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

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

(Multiple Choice)
4.9/5
(86)

When working with arrays, why is it beneficial to use a loop with a declared constant equal to the size of the array?

(Essay)
4.7/5
(84)

When populating an array with an initialization list, you do not need to use the new keyword or provide an array size. Explain why this is the case.

(Essay)
4.8/5
(75)

Many programmers feel that breaking out of a for loop early disrupts the loop flow and makes the code harder to understand.

(True/False)
4.9/5
(65)

double[] studentScores; double studentScores[]; Are both of the above statements valid for declaring an array variable? Why or why not?

(Essay)
5.0/5
(79)

When you want to determine whether a variable holds one of many valid values, one option is to use a do…while loop to compare the variable to a series of valid values.

(True/False)
4.9/5
(70)

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

(Short Answer)
4.8/5
(80)

When you create an array variable, memory space is automatically reserved.

(True/False)
4.7/5
(80)

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

(Multiple Choice)
5.0/5
(75)

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

(Multiple Choice)
4.9/5
(81)

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'.

(Multiple Choice)
5.0/5
(76)

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

(Multiple Choice)
4.7/5
(71)

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

(Multiple Choice)
4.8/5
(73)

The following statement declares an array: int[] scoreArray = {2, 14, 35, 67, 85}; final int INCREASE = 3; Create a loop that will add INCREASE to every array element. Use the length field in the loop that will contain the number of elements in the array.

(Essay)
4.9/5
(68)

String[] countyNames = {"Clark", "Delaware", "Madison"}; Using the above statement, what will be the value of countyNames[0] , countyNames[1] , and countyNames[2] ?

(Essay)
4.7/5
(68)
Match each term with the correct statement below.
A nonprimitive object
array variable
Hold memory addresses where values are stored
int
Declared in the same way you declare any simple variable
elements
Correct Answer:
Verified
Premises:
Responses:
A nonprimitive object
array variable
Hold memory addresses where values are stored
int
Declared in the same way you declare any simple variable
elements
Numbered beginning with 0
return
A statement used to return an array from a method
reference types
An enhanced for loop
Java object names
A primitive type
reference type
Represent computer memory addresses
foreach loop
An array field
length
(Matching)
4.9/5
(67)

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

(Multiple Choice)
4.9/5
(84)

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

(Multiple Choice)
4.9/5
(78)

Write the statement to declare an array variable named studentScores with type double . Write a second statement to create an array of 10 objects of type double .

(Short Answer)
4.8/5
(87)

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

(Multiple Choice)
4.8/5
(85)
Showing 41 - 60 of 66
close modal

Filters

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