Exam 8: Arrays

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

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

(Multiple Choice)
4.8/5
(83)

public static int[] sampleArray() {     int studentScores = {72, 91, 83};     ____ } Using the above code, write the statement that will return the array name.

(Short Answer)
4.9/5
(85)

When an application contains an array and you want to use every element of the array in some task, it is common to perform loops that vary the loop control variable from 0 to one less than the size of the array.

(True/False)
4.9/5
(83)

Write the statement to declare an array of integers that will hold studentScores .

(Essay)
4.9/5
(80)

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

(Essay)
4.8/5
(74)

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

(Multiple Choice)
4.8/5
(80)

What is different about passing an array to a method rather than passing a primitive type to a method?

(Essay)
4.9/5
(88)

How would a programmer perform a range match when writing an application that takes into consideration different discount rates for customers? Give an example.

(Essay)
4.9/5
(90)

Since an array name is a reference, you are able to use the = operator for assigning and the == operator for comparisons.

(True/False)
4.9/5
(84)

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.8/5
(95)
Match each term with the correct statement below.
Premises:
Declared in the same way you declare any simple variable, but with square brackets
Responses:
elements
int
passed by value
Correct Answer:
Verified
Premises:
Responses:
Declared in the same way you declare any simple variable, but with square brackets
elements
(Matching)
4.8/5
(72)

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

(Multiple Choice)
5.0/5
(83)

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

(Multiple Choice)
4.8/5
(73)

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

(Multiple Choice)
4.8/5
(77)

When array elements are passed by value, a copy of the value is made and used within the receiving method.

(True/False)
4.9/5
(72)

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
(68)
Match each term with the correct statement below.
Premises:
Hold memory addresses where values are stored
Responses:
array variable
reference types
enhanced for loop
Correct Answer:
Verified
Premises:
Responses:
Hold memory addresses where values are stored
array variable
(Matching)
4.7/5
(90)

How would you use a method that belongs to an object that is part of the array? Use an example and demonstrate with Java code.

(Essay)
4.8/5
(72)

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)
4.9/5
(74)

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.8/5
(76)
Showing 21 - 40 of 77
close modal

Filters

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