Deck 8: Arrays

ملء الشاشة (f)
exit full mode
سؤال
Languages such as Visual Basic, BASIC, and COBOL use ____ to refer to individual array elements.

A) ( )
B) [ ]
C) { }
D) < >
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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'.

A) empty
B) null
C) false
D) zero
سؤال
To initialize an array, you use an initialization list of values separated by commas and enclosed within curly braces.
سؤال
After you create an array variable, you still need to ____ memory space.

A) create
B) organize
C) reserve
D) dump
سؤال
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.
سؤال
When you create an array variable, memory space is automatically reserved.
سؤال
When you declare or access an array, you can use any expression to represent the size, as long as the expression is  _____.

A) a variable
B) enclosed in brackets
C) an integer
D) a list
سؤال
When array elements are passed by value, a copy of the value is made and used within the receiving method.
سؤال
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.
سؤال
Since an array name is a reference, you are able to use the = operator for assigning and the == operator for comparisons.
سؤال
When returning an array reference, square brackets are included with the return type in the method header.
سؤال
In Java, boolean array elements automatically are assigned the value ____.

A) null
B) '\u0000'
C) true
D) false
سؤال
Parallel arrays do not necessarily have the same number of elements.
سؤال
You use a ____ following the closing brace of an array initialization list.

A) .
B) ;
C) :
D) ,
سؤال
When any ____ type ( boolean , char , byte , short , int , long , float , or double ) is passed to a method, the value is passed.

A) array
B) dummy
C) element
D) primitive
سؤال
Providing values for all the elements in an array is called ____ the array.

A) populating
B) declaring
C) filling
D) irrigating
سؤال
When you create an array of objects, each reference is assigned the value ____.

A) null
B) '\u0000'
C) true
D) false
سؤال
A(n) ____ is an integer contained within square brackets that indicates one of an array's variables.

A) postscript
B) subscript
C) variable header
D) indicator
سؤال
You can declare an array variable by placing curly brackets after the array name.
سؤال
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.
سؤال
If a class has only a default constructor, you must call the constructor using the keyword ____ for each declared array element.

A) default
B) new
C) first
D) object
سؤال
When you declare  int[] someNums = new int[10]; , each element of  someNums  has a value of ____.

A) 0
B) null
C) 0.0
D) \u0000
سؤال
When any primitive type is passed to a method, the ____ is passed.

A) address
B) return type
C) unsigned value
D) value
سؤال
In which of the following statements is the value of myVals null ?

A) int myVals = ""
B) int [] myVals;
C) myVals = int[null]
D) int[null] = myVals
سؤال
Which of the following statements correctly declares and creates an array to hold five double scores values?

A) integer[] scores = new double[5]
B) double[] scores = new integer[5]
C) double[] = new scores[5]
D) double[] scores = new double[5]
سؤال
A(n) ____ is a variable that holds a value as an indicator of whether some condition has been met.

A) reference
B) flag
C) property
D) initializer
سؤال
When you declare or access an array, you can use any expression to represent the size, as long as the expression is a(n) ____.

A) number
B) variable
C) integer
D) value less than 1,000,000
سؤال
The length ____ contains the number of elements in the array.

A) box
B) field
C) area
D) block
سؤال
When you perform a ____, you compare a value to the endpoints of numerical ranges to find the category in which a value belongs.

A) range match
B) sort
C) reference
D) search
سؤال
Which of the following statements correctly initializes an array with an initialization list?

A) int[] nums = {2, 4, 8};
B) int[] nums = (2, 4, 8);
C) int nums = [2, 4, 8];
D) int nums() = int{2, 4, 8}
سؤال
When a method returns an array reference, you include ____ with the return type in the method header.

A) { }
B) ( )
C) < >
D) [ ]
سؤال
An instance variable or object field is also called a(n) ____ of the object.

A) instance
B) method
C) property
D) initial value
سؤال
Individual array elements are ____ by value when a copy of the value is made and used within the receiving method.

A) sorted
B) passed
C) received
D) stored
سؤال
A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable.

A) do…while
B) inner
C) enhanced for
D) enhanced while
سؤال
It is a good programming practice to ensure that a subscript to an array does not fall below zero, causing a(n) ____.

A) array dump
B) runtime error
C) logic error
D) compiler error
سؤال
When any primitive type variable is passed to a method, the _____ is passed.

A) value
B) reference
C) location
D) memory
سؤال
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.

A) tabs
B) indentation
C) spacing
D) dashes
سؤال
Which of the following println statements will display the last myScores element in an array of 10?

A) System.out.println(vals[0]);
B) System.out.println(vals[1]);
C) System.out.println(vals[9]);
D) System.out.println(vals[10]);
سؤال
A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.

A) cloned
B) parallel
C) property
D) two-dimensional
سؤال
Comparing a variable to a list of values in an array is a process called ____ an array.

A) validating
B) using
C) checking
D) searching
سؤال
Match between columns
A primitive type
array variable
A primitive type
reference type
A primitive type
elements
A primitive type
int
A primitive type
Java object names
A primitive type
length
A primitive type
foreach loop
A primitive type
reference types
A primitive type
return
A primitive type
subscript
A primitive type
enhanced for loop
A primitive type
parallel arrays
A primitive type
passed by value
A primitive type
range match
A primitive type
out of bounds
سؤال
Match between columns
Represent computer memory addresses
array variable
Represent computer memory addresses
reference type
Represent computer memory addresses
elements
Represent computer memory addresses
int
Represent computer memory addresses
Java object names
Represent computer memory addresses
length
Represent computer memory addresses
foreach loop
Represent computer memory addresses
reference types
Represent computer memory addresses
return
Represent computer memory addresses
subscript
Represent computer memory addresses
enhanced for loop
Represent computer memory addresses
parallel arrays
Represent computer memory addresses
passed by value
Represent computer memory addresses
range match
Represent computer memory addresses
out of bounds
سؤال
Match between columns
Declared in the same way you declare any simple variable, but with square brackets
array variable
Declared in the same way you declare any simple variable, but with square brackets
reference type
Declared in the same way you declare any simple variable, but with square brackets
elements
Declared in the same way you declare any simple variable, but with square brackets
int
Declared in the same way you declare any simple variable, but with square brackets
Java object names
Declared in the same way you declare any simple variable, but with square brackets
length
Declared in the same way you declare any simple variable, but with square brackets
foreach loop
Declared in the same way you declare any simple variable, but with square brackets
reference types
Declared in the same way you declare any simple variable, but with square brackets
return
Declared in the same way you declare any simple variable, but with square brackets
subscript
Declared in the same way you declare any simple variable, but with square brackets
enhanced for loop
Declared in the same way you declare any simple variable, but with square brackets
parallel arrays
Declared in the same way you declare any simple variable, but with square brackets
passed by value
Declared in the same way you declare any simple variable, but with square brackets
range match
Declared in the same way you declare any simple variable, but with square brackets
out of bounds
سؤال
Describe a situation in which storing just one value at a time in memory does not meet your needs.
سؤال
Match between columns
A statement used to return an array from a method
array variable
A statement used to return an array from a method
reference type
A statement used to return an array from a method
elements
A statement used to return an array from a method
int
A statement used to return an array from a method
Java object names
A statement used to return an array from a method
length
A statement used to return an array from a method
foreach loop
A statement used to return an array from a method
reference types
A statement used to return an array from a method
return
A statement used to return an array from a method
subscript
A statement used to return an array from a method
enhanced for loop
A statement used to return an array from a method
parallel arrays
A statement used to return an array from a method
passed by value
A statement used to return an array from a method
range match
A statement used to return an array from a method
out of bounds
سؤال
What does an array's name represent and what value does it hold when declared?
سؤال
Match between columns
Numbered beginning with 0
array variable
Numbered beginning with 0
reference type
Numbered beginning with 0
elements
Numbered beginning with 0
int
Numbered beginning with 0
Java object names
Numbered beginning with 0
length
Numbered beginning with 0
foreach loop
Numbered beginning with 0
reference types
Numbered beginning with 0
return
Numbered beginning with 0
subscript
Numbered beginning with 0
enhanced for loop
Numbered beginning with 0
parallel arrays
Numbered beginning with 0
passed by value
Numbered beginning with 0
range match
Numbered beginning with 0
out of bounds
سؤال
Match between columns
An array field
array variable
An array field
reference type
An array field
elements
An array field
int
An array field
Java object names
An array field
length
An array field
foreach loop
An array field
reference types
An array field
return
An array field
subscript
An array field
enhanced for loop
An array field
parallel arrays
An array field
passed by value
An array field
range match
An array field
out of bounds
سؤال
Match between columns
Hold memory addresses where values are stored
array variable
Hold memory addresses where values are stored
reference type
Hold memory addresses where values are stored
elements
Hold memory addresses where values are stored
int
Hold memory addresses where values are stored
Java object names
Hold memory addresses where values are stored
length
Hold memory addresses where values are stored
foreach loop
Hold memory addresses where values are stored
reference types
Hold memory addresses where values are stored
return
Hold memory addresses where values are stored
subscript
Hold memory addresses where values are stored
enhanced for loop
Hold memory addresses where values are stored
parallel arrays
Hold memory addresses where values are stored
passed by value
Hold memory addresses where values are stored
range match
Hold memory addresses where values are stored
out of bounds
سؤال
Match between columns
Two or more arrays in which the values in corresponding elements are related
array variable
Two or more arrays in which the values in corresponding elements are related
reference type
Two or more arrays in which the values in corresponding elements are related
elements
Two or more arrays in which the values in corresponding elements are related
int
Two or more arrays in which the values in corresponding elements are related
Java object names
Two or more arrays in which the values in corresponding elements are related
length
Two or more arrays in which the values in corresponding elements are related
foreach loop
Two or more arrays in which the values in corresponding elements are related
reference types
Two or more arrays in which the values in corresponding elements are related
return
Two or more arrays in which the values in corresponding elements are related
subscript
Two or more arrays in which the values in corresponding elements are related
enhanced for loop
Two or more arrays in which the values in corresponding elements are related
parallel arrays
Two or more arrays in which the values in corresponding elements are related
passed by value
Two or more arrays in which the values in corresponding elements are related
range match
Two or more arrays in which the values in corresponding elements are related
out of bounds
سؤال
When working with arrays, why is it beneficial to use a loop with a declared constant equal to the size of the array?
سؤال
Match between columns
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
array variable
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
reference type
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
elements
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
int
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
Java object names
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
length
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
foreach loop
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
reference types
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
return
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
subscript
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
enhanced for loop
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
parallel arrays
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
passed by value
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
range match
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
out of bounds
سؤال
Match between columns
Using a subscript that is too small (that is, negative) or too large for an array,
array variable
Using a subscript that is too small (that is, negative) or too large for an array,
reference type
Using a subscript that is too small (that is, negative) or too large for an array,
elements
Using a subscript that is too small (that is, negative) or too large for an array,
int
Using a subscript that is too small (that is, negative) or too large for an array,
Java object names
Using a subscript that is too small (that is, negative) or too large for an array,
length
Using a subscript that is too small (that is, negative) or too large for an array,
foreach loop
Using a subscript that is too small (that is, negative) or too large for an array,
reference types
Using a subscript that is too small (that is, negative) or too large for an array,
return
Using a subscript that is too small (that is, negative) or too large for an array,
subscript
Using a subscript that is too small (that is, negative) or too large for an array,
enhanced for loop
Using a subscript that is too small (that is, negative) or too large for an array,
parallel arrays
Using a subscript that is too small (that is, negative) or too large for an array,
passed by value
Using a subscript that is too small (that is, negative) or too large for an array,
range match
Using a subscript that is too small (that is, negative) or too large for an array,
out of bounds
سؤال
Match between columns
A nonprimitive object
array variable
A nonprimitive object
reference type
A nonprimitive object
elements
A nonprimitive object
int
A nonprimitive object
Java object names
A nonprimitive object
length
A nonprimitive object
foreach loop
A nonprimitive object
reference types
A nonprimitive object
return
A nonprimitive object
subscript
A nonprimitive object
enhanced for loop
A nonprimitive object
parallel arrays
A nonprimitive object
passed by value
A nonprimitive object
range match
A nonprimitive object
out of bounds
سؤال
What is a subscript and how are the array's elements numbered?
سؤال
Match between columns
A copy of the value is made and used within the receiving method
array variable
A copy of the value is made and used within the receiving method
reference type
A copy of the value is made and used within the receiving method
elements
A copy of the value is made and used within the receiving method
int
A copy of the value is made and used within the receiving method
Java object names
A copy of the value is made and used within the receiving method
length
A copy of the value is made and used within the receiving method
foreach loop
A copy of the value is made and used within the receiving method
reference types
A copy of the value is made and used within the receiving method
return
A copy of the value is made and used within the receiving method
subscript
A copy of the value is made and used within the receiving method
enhanced for loop
A copy of the value is made and used within the receiving method
parallel arrays
A copy of the value is made and used within the receiving method
passed by value
A copy of the value is made and used within the receiving method
range match
A copy of the value is made and used within the receiving method
out of bounds
سؤال
Match between columns
An enhanced for loop
array variable
An enhanced for loop
reference type
An enhanced for loop
elements
An enhanced for loop
int
An enhanced for loop
Java object names
An enhanced for loop
length
An enhanced for loop
foreach loop
An enhanced for loop
reference types
An enhanced for loop
return
An enhanced for loop
subscript
An enhanced for loop
enhanced for loop
An enhanced for loop
parallel arrays
An enhanced for loop
passed by value
An enhanced for loop
range match
An enhanced for loop
out of bounds
سؤال
Match between columns
An integer that specifies an array element
array variable
An integer that specifies an array element
reference type
An integer that specifies an array element
elements
An integer that specifies an array element
int
An integer that specifies an array element
Java object names
An integer that specifies an array element
length
An integer that specifies an array element
foreach loop
An integer that specifies an array element
reference types
An integer that specifies an array element
return
An integer that specifies an array element
subscript
An integer that specifies an array element
enhanced for loop
An integer that specifies an array element
parallel arrays
An integer that specifies an array element
passed by value
An integer that specifies an array element
range match
An integer that specifies an array element
out of bounds
سؤال
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.
سؤال
Match between columns
Allows you to cycle through an array without specifying the starting and ending elements
array variable
Allows you to cycle through an array without specifying the starting and ending elements
reference type
Allows you to cycle through an array without specifying the starting and ending elements
elements
Allows you to cycle through an array without specifying the starting and ending elements
int
Allows you to cycle through an array without specifying the starting and ending elements
Java object names
Allows you to cycle through an array without specifying the starting and ending elements
length
Allows you to cycle through an array without specifying the starting and ending elements
foreach loop
Allows you to cycle through an array without specifying the starting and ending elements
reference types
Allows you to cycle through an array without specifying the starting and ending elements
return
Allows you to cycle through an array without specifying the starting and ending elements
subscript
Allows you to cycle through an array without specifying the starting and ending elements
enhanced for loop
Allows you to cycle through an array without specifying the starting and ending elements
parallel arrays
Allows you to cycle through an array without specifying the starting and ending elements
passed by value
Allows you to cycle through an array without specifying the starting and ending elements
range match
Allows you to cycle through an array without specifying the starting and ending elements
out of bounds
سؤال
int[] multsOfTen = {10, 20, 30, 40, 50, 60};
The above code creates an array named multsOfTen . Describe how array sizes are determined when using an initialization list and how memory is assigned.
سؤال
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.
سؤال
Using just one statement, declare and create an array that will reserve memory locations for 10 scores values that are type double .
سؤال
While you can provide any legal identifier you want for an array, conventional rules are typically followed. List and describe the naming conventions for naming arrays.
سؤال
public static int[] sampleArray()
{
    int studentScores = {72, 91, 83};
    ____
}
Using the above code, write the statement that will return the array name.
سؤال
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.
سؤال
What is different about passing an array to a method rather than passing a primitive type to a method?
سؤال
How would a programmer perform a range match when writing an application that takes into consideration different discount rates for customers? Give an example.
سؤال
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.
سؤال
Why would you use spacing when initializing parallel arrays?
سؤال
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.
سؤال
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?
سؤال
double[] studentScores = new double[3];
studentScores[0] = 93;
studentScores[1] = 77;
studentScores[2] = 85;
Write a println statement to display the last element of the studentScores array.
سؤال
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.
سؤال
Write the statement to declare an array of integers that will hold studentScores .
سؤال
double[] studentScores;
double studentScores[];​
Are both of the above statements valid for declaring an array variable? Why or why not?
سؤال
How can you use the enhanced for loop?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/77
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 8: Arrays
1
Languages such as Visual Basic, BASIC, and COBOL use ____ to refer to individual array elements.

A) ( )
B) [ ]
C) { }
D) < >
A
2
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'.

A) empty
B) null
C) false
D) zero
B
3
To initialize an array, you use an initialization list of values separated by commas and enclosed within curly braces.
True
4
After you create an array variable, you still need to ____ memory space.

A) create
B) organize
C) reserve
D) dump
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
5
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
6
When you create an array variable, memory space is automatically reserved.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
7
When you declare or access an array, you can use any expression to represent the size, as long as the expression is  _____.

A) a variable
B) enclosed in brackets
C) an integer
D) a list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
8
When array elements are passed by value, a copy of the value is made and used within the receiving method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
9
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
10
Since an array name is a reference, you are able to use the = operator for assigning and the == operator for comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
11
When returning an array reference, square brackets are included with the return type in the method header.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
12
In Java, boolean array elements automatically are assigned the value ____.

A) null
B) '\u0000'
C) true
D) false
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
13
Parallel arrays do not necessarily have the same number of elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
14
You use a ____ following the closing brace of an array initialization list.

A) .
B) ;
C) :
D) ,
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
15
When any ____ type ( boolean , char , byte , short , int , long , float , or double ) is passed to a method, the value is passed.

A) array
B) dummy
C) element
D) primitive
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
16
Providing values for all the elements in an array is called ____ the array.

A) populating
B) declaring
C) filling
D) irrigating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
17
When you create an array of objects, each reference is assigned the value ____.

A) null
B) '\u0000'
C) true
D) false
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
18
A(n) ____ is an integer contained within square brackets that indicates one of an array's variables.

A) postscript
B) subscript
C) variable header
D) indicator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
19
You can declare an array variable by placing curly brackets after the array name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
20
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
21
If a class has only a default constructor, you must call the constructor using the keyword ____ for each declared array element.

A) default
B) new
C) first
D) object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
22
When you declare  int[] someNums = new int[10]; , each element of  someNums  has a value of ____.

A) 0
B) null
C) 0.0
D) \u0000
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
23
When any primitive type is passed to a method, the ____ is passed.

A) address
B) return type
C) unsigned value
D) value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
24
In which of the following statements is the value of myVals null ?

A) int myVals = ""
B) int [] myVals;
C) myVals = int[null]
D) int[null] = myVals
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following statements correctly declares and creates an array to hold five double scores values?

A) integer[] scores = new double[5]
B) double[] scores = new integer[5]
C) double[] = new scores[5]
D) double[] scores = new double[5]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
26
A(n) ____ is a variable that holds a value as an indicator of whether some condition has been met.

A) reference
B) flag
C) property
D) initializer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
27
When you declare or access an array, you can use any expression to represent the size, as long as the expression is a(n) ____.

A) number
B) variable
C) integer
D) value less than 1,000,000
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
28
The length ____ contains the number of elements in the array.

A) box
B) field
C) area
D) block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
29
When you perform a ____, you compare a value to the endpoints of numerical ranges to find the category in which a value belongs.

A) range match
B) sort
C) reference
D) search
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following statements correctly initializes an array with an initialization list?

A) int[] nums = {2, 4, 8};
B) int[] nums = (2, 4, 8);
C) int nums = [2, 4, 8];
D) int nums() = int{2, 4, 8}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
31
When a method returns an array reference, you include ____ with the return type in the method header.

A) { }
B) ( )
C) < >
D) [ ]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
32
An instance variable or object field is also called a(n) ____ of the object.

A) instance
B) method
C) property
D) initial value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
33
Individual array elements are ____ by value when a copy of the value is made and used within the receiving method.

A) sorted
B) passed
C) received
D) stored
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
34
A(n) ____ loop allows you to cycle through an array without specifying the starting and ending points for the loop control variable.

A) do…while
B) inner
C) enhanced for
D) enhanced while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
35
It is a good programming practice to ensure that a subscript to an array does not fall below zero, causing a(n) ____.

A) array dump
B) runtime error
C) logic error
D) compiler error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
36
When any primitive type variable is passed to a method, the _____ is passed.

A) value
B) reference
C) location
D) memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
37
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.

A) tabs
B) indentation
C) spacing
D) dashes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the following println statements will display the last myScores element in an array of 10?

A) System.out.println(vals[0]);
B) System.out.println(vals[1]);
C) System.out.println(vals[9]);
D) System.out.println(vals[10]);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
39
A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.

A) cloned
B) parallel
C) property
D) two-dimensional
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
40
Comparing a variable to a list of values in an array is a process called ____ an array.

A) validating
B) using
C) checking
D) searching
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
A primitive type
array variable
A primitive type
reference type
A primitive type
elements
A primitive type
int
A primitive type
Java object names
A primitive type
length
A primitive type
foreach loop
A primitive type
reference types
A primitive type
return
A primitive type
subscript
A primitive type
enhanced for loop
A primitive type
parallel arrays
A primitive type
passed by value
A primitive type
range match
A primitive type
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
42
Match between columns
Represent computer memory addresses
array variable
Represent computer memory addresses
reference type
Represent computer memory addresses
elements
Represent computer memory addresses
int
Represent computer memory addresses
Java object names
Represent computer memory addresses
length
Represent computer memory addresses
foreach loop
Represent computer memory addresses
reference types
Represent computer memory addresses
return
Represent computer memory addresses
subscript
Represent computer memory addresses
enhanced for loop
Represent computer memory addresses
parallel arrays
Represent computer memory addresses
passed by value
Represent computer memory addresses
range match
Represent computer memory addresses
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
43
Match between columns
Declared in the same way you declare any simple variable, but with square brackets
array variable
Declared in the same way you declare any simple variable, but with square brackets
reference type
Declared in the same way you declare any simple variable, but with square brackets
elements
Declared in the same way you declare any simple variable, but with square brackets
int
Declared in the same way you declare any simple variable, but with square brackets
Java object names
Declared in the same way you declare any simple variable, but with square brackets
length
Declared in the same way you declare any simple variable, but with square brackets
foreach loop
Declared in the same way you declare any simple variable, but with square brackets
reference types
Declared in the same way you declare any simple variable, but with square brackets
return
Declared in the same way you declare any simple variable, but with square brackets
subscript
Declared in the same way you declare any simple variable, but with square brackets
enhanced for loop
Declared in the same way you declare any simple variable, but with square brackets
parallel arrays
Declared in the same way you declare any simple variable, but with square brackets
passed by value
Declared in the same way you declare any simple variable, but with square brackets
range match
Declared in the same way you declare any simple variable, but with square brackets
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
44
Describe a situation in which storing just one value at a time in memory does not meet your needs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match between columns
A statement used to return an array from a method
array variable
A statement used to return an array from a method
reference type
A statement used to return an array from a method
elements
A statement used to return an array from a method
int
A statement used to return an array from a method
Java object names
A statement used to return an array from a method
length
A statement used to return an array from a method
foreach loop
A statement used to return an array from a method
reference types
A statement used to return an array from a method
return
A statement used to return an array from a method
subscript
A statement used to return an array from a method
enhanced for loop
A statement used to return an array from a method
parallel arrays
A statement used to return an array from a method
passed by value
A statement used to return an array from a method
range match
A statement used to return an array from a method
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
46
What does an array's name represent and what value does it hold when declared?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
47
Match between columns
Numbered beginning with 0
array variable
Numbered beginning with 0
reference type
Numbered beginning with 0
elements
Numbered beginning with 0
int
Numbered beginning with 0
Java object names
Numbered beginning with 0
length
Numbered beginning with 0
foreach loop
Numbered beginning with 0
reference types
Numbered beginning with 0
return
Numbered beginning with 0
subscript
Numbered beginning with 0
enhanced for loop
Numbered beginning with 0
parallel arrays
Numbered beginning with 0
passed by value
Numbered beginning with 0
range match
Numbered beginning with 0
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
An array field
array variable
An array field
reference type
An array field
elements
An array field
int
An array field
Java object names
An array field
length
An array field
foreach loop
An array field
reference types
An array field
return
An array field
subscript
An array field
enhanced for loop
An array field
parallel arrays
An array field
passed by value
An array field
range match
An array field
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match between columns
Hold memory addresses where values are stored
array variable
Hold memory addresses where values are stored
reference type
Hold memory addresses where values are stored
elements
Hold memory addresses where values are stored
int
Hold memory addresses where values are stored
Java object names
Hold memory addresses where values are stored
length
Hold memory addresses where values are stored
foreach loop
Hold memory addresses where values are stored
reference types
Hold memory addresses where values are stored
return
Hold memory addresses where values are stored
subscript
Hold memory addresses where values are stored
enhanced for loop
Hold memory addresses where values are stored
parallel arrays
Hold memory addresses where values are stored
passed by value
Hold memory addresses where values are stored
range match
Hold memory addresses where values are stored
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
50
Match between columns
Two or more arrays in which the values in corresponding elements are related
array variable
Two or more arrays in which the values in corresponding elements are related
reference type
Two or more arrays in which the values in corresponding elements are related
elements
Two or more arrays in which the values in corresponding elements are related
int
Two or more arrays in which the values in corresponding elements are related
Java object names
Two or more arrays in which the values in corresponding elements are related
length
Two or more arrays in which the values in corresponding elements are related
foreach loop
Two or more arrays in which the values in corresponding elements are related
reference types
Two or more arrays in which the values in corresponding elements are related
return
Two or more arrays in which the values in corresponding elements are related
subscript
Two or more arrays in which the values in corresponding elements are related
enhanced for loop
Two or more arrays in which the values in corresponding elements are related
parallel arrays
Two or more arrays in which the values in corresponding elements are related
passed by value
Two or more arrays in which the values in corresponding elements are related
range match
Two or more arrays in which the values in corresponding elements are related
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
51
When working with arrays, why is it beneficial to use a loop with a declared constant equal to the size of the array?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
52
Match between columns
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
array variable
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
reference type
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
elements
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
int
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
Java object names
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
length
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
foreach loop
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
reference types
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
return
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
subscript
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
enhanced for loop
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
parallel arrays
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
passed by value
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
range match
Comparing a value to the endpoints of numerical ranges to find the category in which the value belongs.
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
53
Match between columns
Using a subscript that is too small (that is, negative) or too large for an array,
array variable
Using a subscript that is too small (that is, negative) or too large for an array,
reference type
Using a subscript that is too small (that is, negative) or too large for an array,
elements
Using a subscript that is too small (that is, negative) or too large for an array,
int
Using a subscript that is too small (that is, negative) or too large for an array,
Java object names
Using a subscript that is too small (that is, negative) or too large for an array,
length
Using a subscript that is too small (that is, negative) or too large for an array,
foreach loop
Using a subscript that is too small (that is, negative) or too large for an array,
reference types
Using a subscript that is too small (that is, negative) or too large for an array,
return
Using a subscript that is too small (that is, negative) or too large for an array,
subscript
Using a subscript that is too small (that is, negative) or too large for an array,
enhanced for loop
Using a subscript that is too small (that is, negative) or too large for an array,
parallel arrays
Using a subscript that is too small (that is, negative) or too large for an array,
passed by value
Using a subscript that is too small (that is, negative) or too large for an array,
range match
Using a subscript that is too small (that is, negative) or too large for an array,
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
54
Match between columns
A nonprimitive object
array variable
A nonprimitive object
reference type
A nonprimitive object
elements
A nonprimitive object
int
A nonprimitive object
Java object names
A nonprimitive object
length
A nonprimitive object
foreach loop
A nonprimitive object
reference types
A nonprimitive object
return
A nonprimitive object
subscript
A nonprimitive object
enhanced for loop
A nonprimitive object
parallel arrays
A nonprimitive object
passed by value
A nonprimitive object
range match
A nonprimitive object
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
55
What is a subscript and how are the array's elements numbered?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
56
Match between columns
A copy of the value is made and used within the receiving method
array variable
A copy of the value is made and used within the receiving method
reference type
A copy of the value is made and used within the receiving method
elements
A copy of the value is made and used within the receiving method
int
A copy of the value is made and used within the receiving method
Java object names
A copy of the value is made and used within the receiving method
length
A copy of the value is made and used within the receiving method
foreach loop
A copy of the value is made and used within the receiving method
reference types
A copy of the value is made and used within the receiving method
return
A copy of the value is made and used within the receiving method
subscript
A copy of the value is made and used within the receiving method
enhanced for loop
A copy of the value is made and used within the receiving method
parallel arrays
A copy of the value is made and used within the receiving method
passed by value
A copy of the value is made and used within the receiving method
range match
A copy of the value is made and used within the receiving method
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
57
Match between columns
An enhanced for loop
array variable
An enhanced for loop
reference type
An enhanced for loop
elements
An enhanced for loop
int
An enhanced for loop
Java object names
An enhanced for loop
length
An enhanced for loop
foreach loop
An enhanced for loop
reference types
An enhanced for loop
return
An enhanced for loop
subscript
An enhanced for loop
enhanced for loop
An enhanced for loop
parallel arrays
An enhanced for loop
passed by value
An enhanced for loop
range match
An enhanced for loop
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
58
Match between columns
An integer that specifies an array element
array variable
An integer that specifies an array element
reference type
An integer that specifies an array element
elements
An integer that specifies an array element
int
An integer that specifies an array element
Java object names
An integer that specifies an array element
length
An integer that specifies an array element
foreach loop
An integer that specifies an array element
reference types
An integer that specifies an array element
return
An integer that specifies an array element
subscript
An integer that specifies an array element
enhanced for loop
An integer that specifies an array element
parallel arrays
An integer that specifies an array element
passed by value
An integer that specifies an array element
range match
An integer that specifies an array element
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
59
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
60
Match between columns
Allows you to cycle through an array without specifying the starting and ending elements
array variable
Allows you to cycle through an array without specifying the starting and ending elements
reference type
Allows you to cycle through an array without specifying the starting and ending elements
elements
Allows you to cycle through an array without specifying the starting and ending elements
int
Allows you to cycle through an array without specifying the starting and ending elements
Java object names
Allows you to cycle through an array without specifying the starting and ending elements
length
Allows you to cycle through an array without specifying the starting and ending elements
foreach loop
Allows you to cycle through an array without specifying the starting and ending elements
reference types
Allows you to cycle through an array without specifying the starting and ending elements
return
Allows you to cycle through an array without specifying the starting and ending elements
subscript
Allows you to cycle through an array without specifying the starting and ending elements
enhanced for loop
Allows you to cycle through an array without specifying the starting and ending elements
parallel arrays
Allows you to cycle through an array without specifying the starting and ending elements
passed by value
Allows you to cycle through an array without specifying the starting and ending elements
range match
Allows you to cycle through an array without specifying the starting and ending elements
out of bounds
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
61
int[] multsOfTen = {10, 20, 30, 40, 50, 60};
The above code creates an array named multsOfTen . Describe how array sizes are determined when using an initialization list and how memory is assigned.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
62
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
63
Using just one statement, declare and create an array that will reserve memory locations for 10 scores values that are type double .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
64
While you can provide any legal identifier you want for an array, conventional rules are typically followed. List and describe the naming conventions for naming arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
65
public static int[] sampleArray()
{
    int studentScores = {72, 91, 83};
    ____
}
Using the above code, write the statement that will return the array name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
66
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
67
What is different about passing an array to a method rather than passing a primitive type to a method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
68
How would a programmer perform a range match when writing an application that takes into consideration different discount rates for customers? Give an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
69
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
70
Why would you use spacing when initializing parallel arrays?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
71
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
72
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
73
double[] studentScores = new double[3];
studentScores[0] = 93;
studentScores[1] = 77;
studentScores[2] = 85;
Write a println statement to display the last element of the studentScores array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
75
Write the statement to declare an array of integers that will hold studentScores .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
76
double[] studentScores;
double studentScores[];​
Are both of the above statements valid for declaring an array variable? Why or why not?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
77
How can you use the enhanced for loop?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 77 في هذه المجموعة.