Deck 7: Arrays and the Arraylist Class

ملء الشاشة (f)
exit full mode
سؤال
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement:

A) str.uppercase();
B) str[0].upperCase();
C) str.toUpperCase();
D) str[0].toUpperCase();
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Subscript numbering always starts at what value?

A) 0
B) 1
C) -1
D) None of the above
سؤال
What do you call the number that is used as an index to pinpoint a specific element within an array?

A) subscript
B) global unique identifier
C) element
D) argument
سؤال
What would be the results after the following code was executed? int[] x = {23, 55, 83, 19};
Int[] y = {36, 78, 12, 24};
For(int a = 0; a < x.length; a++)
{
X[a] = y[a];
Y[a] = x[a];
}

A) x[] = {36, 78, 12, 24} and y[] = {23, 55, 83, 19}
B) x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}
C) x[] = {23, 55, 83, 19} and y[] = {23, 55, 83, 19}
D) This is a compilation error
سؤال
What will be the value of x[1] after the following code is executed? int[] x = {22, 33, 44};
ArrayProcess(x);

Public static void arrayProcess(int[] a)
{
For(int k = 0; k < 3; k++)
{
A[k] = a[k] + 5;
}
}

A) 27
B) 33
C) 38
D) 49
سؤال
Java performs ____________, which means that it does not allow a statement to use a subscript that is outside the range of valid subscripts for the array.

A) active array sequencing
B) array bounds checking
C) scope resolution binding
D) buffer overrun protection
سؤال
It is common practice to use a ____________ variable as a size declarator.

A) static
B) reference
C) final
D) boolean
سؤال
In memory, an array of String objects

A) consists of elements, each of which is a reference to a String object.
B) is always implemented as a ragged array.
C) consists of elements, each of which is a String object.
D) must be initialized when the array is declared.
سؤال
When an array is passed to a method:

A) a reference to the array is passed
B) it is passed just as an object
C) the method has direct access to the original array
D) All of the above
سؤال
What do you normally use with a partially-filled array?

A) A class that does nothing but manage the array
B) An accompanying parallel array
C) An accompanying integer value that holds the number of items stored in the array
D) An accumulator
سؤال
This indicates the number of elements, or values, the array can hold.

A) the new operator
B) the array's size declarator
C) the array's data type
D) the version of Java
سؤال
Each array in Java has a public field named ____________ that contains the number of elements in the array.

A) size
B) capacity
C) length
D) limit
سؤال
In Java, you do not use the new operator when you use a(n):

A) array size declarator
B) initialization list
C) two-dimensional array
D) All of the above
سؤال
What does the following statement do? double[] array1 = new double[10];

A) Declares array1 to be a reference to an array of double values
B) Creates an instance of an array of 10 double values
C) Will allow valid subscripts in the range of 0 - 9
D) All of the above
سؤال
What will be the results of the following code? final int ARRAY_SIZE = 5;
Double[] x = new double[ARRAY_SIZE];
For(int i = 1; i <= ARRAY_SIZE; i++)
{
X[i] = 10.0;
}

A) All the values in the array are initialized to 10.0
B) All the values, except the first, are set to 10.0
C) An error will occur when the program runs.
D) There will be a compilation error
سؤال
To return an array of long values from a method, use this as the return type for the method.

A) long
B) long[]
C) long[ARRAY_SIZE]
D) []long
سؤال
What would be the results of the following code? int[] array1 = new int[25];
… // Code that will put values in array1
Int value = array1[0];
For (int a = 1; a < array1.length; a++)
{
If (array1[a] < value)
Value = array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) value contains the average of the values in array1
سؤال
What would be the results of the following code? int[] x = { 55, 33, 88, 22, 99,
11, 44, 66, 77 };
Int a = 10;
If(x[2] > x[5])
A = 5;
Else
A = 8;

A) a = 5
B) a = 8
C) a = 10
D) This is a compilation error, you cannot compare array elements
سؤال
What will be the value of x[8] after the following code has been executed? final int SUB = 12;
Int[] x = new int[SUB];
Int y = 100;
For(int i = 0; i < SUB; i++)
{
X[i] = y;
Y += 10;
}

A) 170
B) 180
C) 190
D) 200
سؤال
By default, Java initializes array elements with what value?

A) 0
B) 100
C) 1
D) -1
سؤال
What would be the results after the following code was executed? int[] x = {23, 55, 83, 19};
Int[] y = {36, 78, 12, 24};
X = y;
Y = x;

A) x[] = {36, 78, 12, 24} and y[] = {23, 55, 83, 19}
B) x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}
C) x[] = {23, 55, 83, 19} and y[] = {23, 55, 83, 19}
D) This is a compilation error
سؤال
Which of the following is a correct method header for receiving a two-dimensional array as an argument?

A) public static void passArray(int[1,2])
B) public static void passArray(int [][])
C) public static void passArray(int[1],[2])
D) public static void passArray(int[], int[])
سؤال
The binary search algorithm:

A) is less efficient than the sequential search algorithm
B) will cut the portion of the array being searched in half each time the loop fails to locate the search value
C) will have a maximum number of comparisons equal to the number of elements in the array
D) will have an average of N/2 comparisons, where N is the number of elements in the array
سؤال
What would be the results of the following code? final int SIZE = 25;
Int[] array1 = new int[SIZE];
… // Code that will put values in array1
Int value = 0;
For (int a = 0; a <= array1.length; a++)
{
Value += array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) This would cause the program to crash
سؤال
What would be the results of the following code? final int SIZE = 25;
Int[] array1 = new int[SIZE];
… // Code that will put values in array1
Int value = 0;
For (int a = 0; a < array1.length; a++)
{
Value += array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) This would cause the program to crash
سؤال
A ragged array is:

A) a two-dimensional array for which the number of rows is unknown
B) a one-dimensional array for which the number of elements is unknown
C) a two-dimensional array where the rows are of different lengths
D) There is no such thing as a ragged array
سؤال
If numbers is a two-dimensional array, which of the following would give the length of row r?

A) numbers.length
B) numbers.length[r]
C) numbers[r].length[r]
D) numbers[r].length
سؤال
What will be returned from the following method? public static float[] getValue(int x)

A) A float value
B) An array of float values
C) An integer
D) An array of integers
سؤال
What will be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5};

A) An array of 6 values ranging from 0 through 5 and referenced by the variable x will be created
B) A compilation error will occur
C) The program will crash when it is executed
D) The value of x[1] will be 0, x[2] will be 0, x[3] will be 0, x[4] will be 0, x[5] will be 0, and x[6] will be 0.
سؤال
Which of the statements are true about the following code? final int ARRAY_SIZE = 10;
Long[] array1 = new long[ARRAY_SIZE];

A) Declares array1 to be a reference to an array of long values
B) Creates an instance of an array of 10 long values
C) Will allow valid subscripts in the range of 0 - 9
D) All of the above
سؤال
Given the following two-dimensional array declaration, which statement is true? int [][] numbers = new int [6] [9];

A) The array numbers has 6 columns and 9 rows
B) The array numbers has 6 rows and 9 columns
C) The array numbers has 15 rows
D) The array numbers has 54 rows
سؤال
Which of the following for loops is valid, given the following declaration? String[] names = {"abc", "def", "ghi", "jkl"};

A) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length);
B) for (int i = 0; i < names.length(); i++)
System.out.println(names[i].length);
C) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length());
D) for (int i = 0; i < names.length(); i++)
System.out.println(names[i].length());
سؤال
What will be the value of x[8] after the following code has been executed? final int SUB = 12;
Int[] x = new int[SUB];
Int y = 20;
For(int i = 0; i < SUB; i++)
{
X[i] = y;
Y += 5;
}

A) 50
B) 55
C) 60
D) 65
سؤال
If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]?

A) 1 through 15
B) 1 through 14
C) 0 through 14
D) 0 through 15
سؤال
The sequential search algorithm:

A) requires the array to be ordered
B) must always be implemented as a method
C) uses a loop to sequentially step through an array, starting with the first element
D) will not execute, if the element is not in the array
سؤال
For the following code, what would be the value of str[2]? String[] str = {"abc", "def", "ghi", "jkl"};

A) "ghi"
B) "def"
C) A reference to the String "ghi"
D) A reference to the String "def"
سؤال
When an individual element of an array is passed to a method:

A) a reference to the array is passed
B) it is passed like any other variable
C) the method does not have direct access to the original array
D) All of the above
سؤال
In order to do a binary search on an array,

A) the values of the array must be numeric
B) the array must first be sorted in ascending order
C) you must first do a sequential search of the array to assure the element you are looking for is there
D) There are no requirements
سؤال
What is the value of scores[2][3] in the following array? int [] [] scores = { {88, 80, 79, 92}, {75, 84, 93, 80},
{98, 95, 92, 94}, {91, 84, 88, 96} };

A) 94
B) 84
C) 93
D) 95
سؤال
A search algorithm:

A) is a way to locate a specific item in a larger collection of data
B) is rarely used with arrays
C) arranges elements in ascending order
D) arranges elements in descending order
سؤال
Java limits the number of dimensions that an array may have to 15.
سؤال
Any items typed on the command-line, separated by space, after the name of the class are considered to be one or more arguments that are to be passed into the main method.
سؤال
Which of the following is a valid declaration for a ragged array?

A) int[] ragged = new int[5];
B) int[][] ragged = new int[5][6];
C) int[][] ragged = new int[5][];
D) int[][] ragged = new int[][5];
سؤال
If a[] and b[] are two integer arrays, the expression a == b compares the array contents.
سؤال
The following statement creates an ArrayList object. What is the purpose of the notation? ArrayList arr = new ArrayList();

A) It specifies that only String objects may be stored in the ArrayList object.
B) It specifies that the get method will return only String objects.
C) It specifies that String objects may not be stored in the ArrayList object.
D) It specifies that everything stored in the ArrayList object will be converted to a String.
سؤال
When an array of objects is declared, but not initialized, the array values are set to null.
سؤال
To compare the contents of two arrays, you must compare the elements of the two arrays.
سؤال
This ArrayList class method is used to insert an item into an ArrayList.

A) insert
B) add
C) store
D) putItem
سؤال
If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?

A) for (int row = 1; row < numbers.length; row++)
{
For (int col = 1; col < numbers.length; col++)
Total += numbers[row][col];
}
B) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
C) for (int row = 0; row < numbers[row].length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
D) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers[row].length; col++)
Total += numbers[row][col];
}
سؤال
Objects in an array are accessed with subscripts, just like any other data type in an array.
سؤال
Declaring an array reference variable does not create an array.
سؤال
An array can hold multiple values of several different data types simultaneously.
سؤال
You can use this ArrayList class method to replace an item at a specific location in an ArrayList.

A) replace
B) add
C) store
D) set
سؤال
Once an array is created, its size cannot be changed.
سؤال
A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order.
سؤال
You use this method to determine the number of items stored in an ArrayList object.

A) numberItems
B) capacity
C) size
D) items
سؤال
You can use this ArrayList class method to insert an item at a specific location in an ArrayList.

A) insert
B) add
C) store
D) putItem
سؤال
This ArrayList class method deletes an item from an ArrayList.

A) remove
B) delete
C) erase
D) purge
سؤال
Which of the following is a correct method header for receiving a two-dimensional array as an argument?

A) public static void passArray(int[2])
B) public static void passArray(int [][])
C) public static void passArray(int[1][2])
D) public static void passArray(int[], int[])
سؤال
The ArrayList class is in this package.

A) java.arraylist
B) java.lang
C) java.array
D) java.util
سؤال
An ArrayList object automatically expands in size to accommodate the items stored in it.
سؤال
The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line.
سؤال
A sorting algorithm is used to locate a specific item in a larger collection of data.
سؤال
Java does not limit the number of dimensions that an array may have.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/64
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Arrays and the Arraylist Class
1
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement:

A) str.uppercase();
B) str[0].upperCase();
C) str.toUpperCase();
D) str[0].toUpperCase();
D
2
Subscript numbering always starts at what value?

A) 0
B) 1
C) -1
D) None of the above
A
3
What do you call the number that is used as an index to pinpoint a specific element within an array?

A) subscript
B) global unique identifier
C) element
D) argument
A
4
What would be the results after the following code was executed? int[] x = {23, 55, 83, 19};
Int[] y = {36, 78, 12, 24};
For(int a = 0; a < x.length; a++)
{
X[a] = y[a];
Y[a] = x[a];
}

A) x[] = {36, 78, 12, 24} and y[] = {23, 55, 83, 19}
B) x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}
C) x[] = {23, 55, 83, 19} and y[] = {23, 55, 83, 19}
D) This is a compilation error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
5
What will be the value of x[1] after the following code is executed? int[] x = {22, 33, 44};
ArrayProcess(x);

Public static void arrayProcess(int[] a)
{
For(int k = 0; k < 3; k++)
{
A[k] = a[k] + 5;
}
}

A) 27
B) 33
C) 38
D) 49
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
6
Java performs ____________, which means that it does not allow a statement to use a subscript that is outside the range of valid subscripts for the array.

A) active array sequencing
B) array bounds checking
C) scope resolution binding
D) buffer overrun protection
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
7
It is common practice to use a ____________ variable as a size declarator.

A) static
B) reference
C) final
D) boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
8
In memory, an array of String objects

A) consists of elements, each of which is a reference to a String object.
B) is always implemented as a ragged array.
C) consists of elements, each of which is a String object.
D) must be initialized when the array is declared.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
9
When an array is passed to a method:

A) a reference to the array is passed
B) it is passed just as an object
C) the method has direct access to the original array
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
10
What do you normally use with a partially-filled array?

A) A class that does nothing but manage the array
B) An accompanying parallel array
C) An accompanying integer value that holds the number of items stored in the array
D) An accumulator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
11
This indicates the number of elements, or values, the array can hold.

A) the new operator
B) the array's size declarator
C) the array's data type
D) the version of Java
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
12
Each array in Java has a public field named ____________ that contains the number of elements in the array.

A) size
B) capacity
C) length
D) limit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
13
In Java, you do not use the new operator when you use a(n):

A) array size declarator
B) initialization list
C) two-dimensional array
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
14
What does the following statement do? double[] array1 = new double[10];

A) Declares array1 to be a reference to an array of double values
B) Creates an instance of an array of 10 double values
C) Will allow valid subscripts in the range of 0 - 9
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
15
What will be the results of the following code? final int ARRAY_SIZE = 5;
Double[] x = new double[ARRAY_SIZE];
For(int i = 1; i <= ARRAY_SIZE; i++)
{
X[i] = 10.0;
}

A) All the values in the array are initialized to 10.0
B) All the values, except the first, are set to 10.0
C) An error will occur when the program runs.
D) There will be a compilation error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
16
To return an array of long values from a method, use this as the return type for the method.

A) long
B) long[]
C) long[ARRAY_SIZE]
D) []long
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
17
What would be the results of the following code? int[] array1 = new int[25];
… // Code that will put values in array1
Int value = array1[0];
For (int a = 1; a < array1.length; a++)
{
If (array1[a] < value)
Value = array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) value contains the average of the values in array1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
18
What would be the results of the following code? int[] x = { 55, 33, 88, 22, 99,
11, 44, 66, 77 };
Int a = 10;
If(x[2] > x[5])
A = 5;
Else
A = 8;

A) a = 5
B) a = 8
C) a = 10
D) This is a compilation error, you cannot compare array elements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
19
What will be the value of x[8] after the following code has been executed? final int SUB = 12;
Int[] x = new int[SUB];
Int y = 100;
For(int i = 0; i < SUB; i++)
{
X[i] = y;
Y += 10;
}

A) 170
B) 180
C) 190
D) 200
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
20
By default, Java initializes array elements with what value?

A) 0
B) 100
C) 1
D) -1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
21
What would be the results after the following code was executed? int[] x = {23, 55, 83, 19};
Int[] y = {36, 78, 12, 24};
X = y;
Y = x;

A) x[] = {36, 78, 12, 24} and y[] = {23, 55, 83, 19}
B) x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}
C) x[] = {23, 55, 83, 19} and y[] = {23, 55, 83, 19}
D) This is a compilation error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following is a correct method header for receiving a two-dimensional array as an argument?

A) public static void passArray(int[1,2])
B) public static void passArray(int [][])
C) public static void passArray(int[1],[2])
D) public static void passArray(int[], int[])
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
23
The binary search algorithm:

A) is less efficient than the sequential search algorithm
B) will cut the portion of the array being searched in half each time the loop fails to locate the search value
C) will have a maximum number of comparisons equal to the number of elements in the array
D) will have an average of N/2 comparisons, where N is the number of elements in the array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
24
What would be the results of the following code? final int SIZE = 25;
Int[] array1 = new int[SIZE];
… // Code that will put values in array1
Int value = 0;
For (int a = 0; a <= array1.length; a++)
{
Value += array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) This would cause the program to crash
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
25
What would be the results of the following code? final int SIZE = 25;
Int[] array1 = new int[SIZE];
… // Code that will put values in array1
Int value = 0;
For (int a = 0; a < array1.length; a++)
{
Value += array1[a];
}

A) value contains the highest value in array1
B) value contains the lowest value in array1
C) value contains the sum of all the values in array1
D) This would cause the program to crash
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
26
A ragged array is:

A) a two-dimensional array for which the number of rows is unknown
B) a one-dimensional array for which the number of elements is unknown
C) a two-dimensional array where the rows are of different lengths
D) There is no such thing as a ragged array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
27
If numbers is a two-dimensional array, which of the following would give the length of row r?

A) numbers.length
B) numbers.length[r]
C) numbers[r].length[r]
D) numbers[r].length
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
28
What will be returned from the following method? public static float[] getValue(int x)

A) A float value
B) An array of float values
C) An integer
D) An array of integers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
29
What will be the result of executing the following code? int[] x = {0, 1, 2, 3, 4, 5};

A) An array of 6 values ranging from 0 through 5 and referenced by the variable x will be created
B) A compilation error will occur
C) The program will crash when it is executed
D) The value of x[1] will be 0, x[2] will be 0, x[3] will be 0, x[4] will be 0, x[5] will be 0, and x[6] will be 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the statements are true about the following code? final int ARRAY_SIZE = 10;
Long[] array1 = new long[ARRAY_SIZE];

A) Declares array1 to be a reference to an array of long values
B) Creates an instance of an array of 10 long values
C) Will allow valid subscripts in the range of 0 - 9
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
31
Given the following two-dimensional array declaration, which statement is true? int [][] numbers = new int [6] [9];

A) The array numbers has 6 columns and 9 rows
B) The array numbers has 6 rows and 9 columns
C) The array numbers has 15 rows
D) The array numbers has 54 rows
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following for loops is valid, given the following declaration? String[] names = {"abc", "def", "ghi", "jkl"};

A) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length);
B) for (int i = 0; i < names.length(); i++)
System.out.println(names[i].length);
C) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length());
D) for (int i = 0; i < names.length(); i++)
System.out.println(names[i].length());
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
33
What will be the value of x[8] after the following code has been executed? final int SUB = 12;
Int[] x = new int[SUB];
Int y = 20;
For(int i = 0; i < SUB; i++)
{
X[i] = y;
Y += 5;
}

A) 50
B) 55
C) 60
D) 65
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
34
If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]?

A) 1 through 15
B) 1 through 14
C) 0 through 14
D) 0 through 15
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
35
The sequential search algorithm:

A) requires the array to be ordered
B) must always be implemented as a method
C) uses a loop to sequentially step through an array, starting with the first element
D) will not execute, if the element is not in the array
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
36
For the following code, what would be the value of str[2]? String[] str = {"abc", "def", "ghi", "jkl"};

A) "ghi"
B) "def"
C) A reference to the String "ghi"
D) A reference to the String "def"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
37
When an individual element of an array is passed to a method:

A) a reference to the array is passed
B) it is passed like any other variable
C) the method does not have direct access to the original array
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
38
In order to do a binary search on an array,

A) the values of the array must be numeric
B) the array must first be sorted in ascending order
C) you must first do a sequential search of the array to assure the element you are looking for is there
D) There are no requirements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
39
What is the value of scores[2][3] in the following array? int [] [] scores = { {88, 80, 79, 92}, {75, 84, 93, 80},
{98, 95, 92, 94}, {91, 84, 88, 96} };

A) 94
B) 84
C) 93
D) 95
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
40
A search algorithm:

A) is a way to locate a specific item in a larger collection of data
B) is rarely used with arrays
C) arranges elements in ascending order
D) arranges elements in descending order
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
41
Java limits the number of dimensions that an array may have to 15.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
42
Any items typed on the command-line, separated by space, after the name of the class are considered to be one or more arguments that are to be passed into the main method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following is a valid declaration for a ragged array?

A) int[] ragged = new int[5];
B) int[][] ragged = new int[5][6];
C) int[][] ragged = new int[5][];
D) int[][] ragged = new int[][5];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
44
If a[] and b[] are two integer arrays, the expression a == b compares the array contents.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
45
The following statement creates an ArrayList object. What is the purpose of the notation? ArrayList arr = new ArrayList();

A) It specifies that only String objects may be stored in the ArrayList object.
B) It specifies that the get method will return only String objects.
C) It specifies that String objects may not be stored in the ArrayList object.
D) It specifies that everything stored in the ArrayList object will be converted to a String.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
46
When an array of objects is declared, but not initialized, the array values are set to null.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
47
To compare the contents of two arrays, you must compare the elements of the two arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
48
This ArrayList class method is used to insert an item into an ArrayList.

A) insert
B) add
C) store
D) putItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
49
If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?

A) for (int row = 1; row < numbers.length; row++)
{
For (int col = 1; col < numbers.length; col++)
Total += numbers[row][col];
}
B) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
C) for (int row = 0; row < numbers[row].length; row++)
{
For (int col = 0; col < numbers.length; col++)
Total += numbers[row][col];
}
D) for (int row = 0; row < numbers.length; row++)
{
For (int col = 0; col < numbers[row].length; col++)
Total += numbers[row][col];
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
50
Objects in an array are accessed with subscripts, just like any other data type in an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
51
Declaring an array reference variable does not create an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
52
An array can hold multiple values of several different data types simultaneously.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
53
You can use this ArrayList class method to replace an item at a specific location in an ArrayList.

A) replace
B) add
C) store
D) set
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
54
Once an array is created, its size cannot be changed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
55
A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
56
You use this method to determine the number of items stored in an ArrayList object.

A) numberItems
B) capacity
C) size
D) items
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
57
You can use this ArrayList class method to insert an item at a specific location in an ArrayList.

A) insert
B) add
C) store
D) putItem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
58
This ArrayList class method deletes an item from an ArrayList.

A) remove
B) delete
C) erase
D) purge
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
59
Which of the following is a correct method header for receiving a two-dimensional array as an argument?

A) public static void passArray(int[2])
B) public static void passArray(int [][])
C) public static void passArray(int[1][2])
D) public static void passArray(int[], int[])
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
60
The ArrayList class is in this package.

A) java.arraylist
B) java.lang
C) java.array
D) java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
61
An ArrayList object automatically expands in size to accommodate the items stored in it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
62
The String[] args parameter in the main method header allows the program to receive arguments from the operating system command-line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
63
A sorting algorithm is used to locate a specific item in a larger collection of data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
64
Java does not limit the number of dimensions that an array may have.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 64 في هذه المجموعة.