Exam 8: Arrays

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags
Match each term with the correct statement below.
Premises:
Using a subscript that is too small (that is, negative) or too large for an array,
Responses:
reference types
enhanced for loop
int
Correct Answer:
Verified
Premises:
Responses:
Using a subscript that is too small (that is, negative) or too large for an array,
reference types
Free
(Matching)
4.8/5
(80)
Correct Answer:
Verified

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

Free
(Multiple Choice)
5.0/5
(91)
Correct Answer:
Verified

D

When using parallel arrays, if one array has many possible matches, it is most efficient to place the less common items first so that they are matched right away.

Free
(True/False)
4.8/5
(95)
Correct Answer:
Verified

False

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

(Multiple Choice)
4.8/5
(100)
Match each term with the correct statement below.
Premises:
Allows you to cycle through an array without specifying the starting and ending elements
Responses:
reference type
subscript
parallel arrays
Correct Answer:
Verified
Premises:
Responses:
Allows you to cycle through an array without specifying the starting and ending elements
reference type
(Matching)
4.9/5
(81)

What is a subscript and how are the array's elements numbered?

(Essay)
4.8/5
(71)

When using an array with all elements used, why would a programmer use a loop control variable from 0 to one less than the size of the array? Give an example.

(Essay)
5.0/5
(75)

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
(74)

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

(Multiple Choice)
4.8/5
(89)
Match each term with the correct statement below.
Premises:
An enhanced for loop
Responses:
elements
passed by value
int
Correct Answer:
Verified
Premises:
Responses:
An enhanced for loop
elements
(Matching)
4.8/5
(85)

Write the statement to create an array named studentScores that will store five integer value student scores. Initialize the array using an initialization list with the values 70, 85, 92, 67, and 76.

(Essay)
4.9/5
(74)

public class CostArray {     public static void main(String[] args)     {        double[] costs = new double[3];        costs[0] = 5.00;        costs[1] = 7.00;        costs[2] = 9.00;        System.out.println(costs[3]);     } } Once the above code is compiled and executed, an error message is generated. Explain the error message that will result and explain the reason for the error.

(Essay)
5.0/5
(82)
Match each term with the correct statement below.
Premises:
Two or more arrays in which the values in corresponding elements are related
Responses:
enhanced for loop
range match
foreach loop
Correct Answer:
Verified
Premises:
Responses:
Two or more arrays in which the values in corresponding elements are related
enhanced for loop
(Matching)
5.0/5
(77)

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

(Multiple Choice)
4.8/5
(78)

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

(Multiple Choice)
4.8/5
(73)

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

(Multiple Choice)
4.8/5
(73)

You can declare an array variable by placing curly brackets after the array name.

(True/False)
4.7/5
(84)

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

(Multiple Choice)
4.8/5
(82)

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

(Multiple Choice)
4.9/5
(87)

Why is the length field a good option when writing a loop that manipulates an array? What programming error is common when attempting to use length as an array method?

(Essay)
4.8/5
(78)
Showing 1 - 20 of 77
close modal

Filters

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