Deck 6: Arrays and Arraylists
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/48
العب
ملء الشاشة (f)
Deck 6: Arrays and Arraylists
1
Consider the class below:
Public class Test
{
Public static void main(String[] args)
{
Int[] a = {99, 22, 11, 3, 11, 55, 44, 88, 2, -3};
Int result = 0;
For (int i = 0; i <
A) Result is: 280.
A)length; i++) {
If (a[i] > 30)
Result += a[i];
}
System.out.printf("Result is: %d%n", result);
}
}
The output of this Java program will be:
B) Result is: 286.
C) Result is: 154.
D) Result is: 332.
Public class Test
{
Public static void main(String[] args)
{
Int[] a = {99, 22, 11, 3, 11, 55, 44, 88, 2, -3};
Int result = 0;
For (int i = 0; i <
A) Result is: 280.
A)length; i++) {
If (a[i] > 30)
Result += a[i];
}
System.out.printf("Result is: %d%n", result);
}
}
The output of this Java program will be:
B) Result is: 286.
C) Result is: 154.
D) Result is: 332.
B
2
A(n) ________ indicates a problem that occurs while a program executes.
A) syntax error
B) omitted import
C) missing semicolon
D) exception
A) syntax error
B) omitted import
C) missing semicolon
D) exception
D
3
Which expression adds 1 to the element of array arrayName at index i?
A) ++arrayName[i].
B) arrayName++[i].
C) arrayName[i++].
D) None of the above.
A) ++arrayName[i].
B) arrayName++[i].
C) arrayName[i++].
D) None of the above.
A
4
Which flag in a format specifier indicates that values with fewer digits than the field width should begin with a leading 0?
A) p.
B) l.
C) w.
D) 0.
A) p.
B) l.
C) w.
D) 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
5
Consider the array:
S[0] = 7
S[1] = 0
S[2] = -12
S[3] = 9
S[4] = 10
S[5] = 3
S[6] = 6
The value of s[s[6] - s[5]] is:
A) 0.
B) 3.
C) 9.
D) 0.
S[0] = 7
S[1] = 0
S[2] = -12
S[3] = 9
S[4] = 10
S[5] = 3
S[6] = 6
The value of s[s[6] - s[5]] is:
A) 0.
B) 3.
C) 9.
D) 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
6
Invalid possibilities for array indices include .
A) Positive integers.
B) Negative integers.
C) Zero.
D) None of the above.
A) Positive integers.
B) Negative integers.
C) Zero.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
7
Consider the code segment below. Which of the following statements is false?
Int[] g;
G = new int[23];
A) The value of g[3] is -1.
B) The first statement declares an array reference.
C) The second statement creates the array.
D) g is a reference to an array of integers.
Int[] g;
G = new int[23];
A) The value of g[3] is -1.
B) The first statement declares an array reference.
C) The second statement creates the array.
D) g is a reference to an array of integers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
8
A programmer must do the following before using an array:
A) declare then reference the array.
B) create then declare the array.
C) create then reference the array.
D) declare then create the array.
A) declare then reference the array.
B) create then declare the array.
C) create then reference the array.
D) declare then create the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
9
Constant variables also are called .
A) write-only variables
B) finals
C) named constants
D) All of the above
A) write-only variables
B) finals
C) named constants
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the following statements is false?
A) A reference to an object is required to invoke an object's methods.
B) A primitive-type variable does not refer to an object.
C) Reference-type instance variables are initialized by default to the value void.
D) A primitive-type variable cannot be used to invoke a method.
A) A reference to an object is required to invoke an object's methods.
B) A primitive-type variable does not refer to an object.
C) Reference-type instance variables are initialized by default to the value void.
D) A primitive-type variable cannot be used to invoke a method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
11
Types in Java are divided into two categories. The primitive types are boolean, byte, char, short, int, long, float and double. All other types are ________ types.
A) static
B) reference
C) declared
D) source
A) static
B) reference
C) declared
D) source
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following initializer lists would correctly set the elements of array n?
A) int[] n = {1, 2, 3, 4, 5};.
B) array n[int] = {1, 2, 3, 4, 5};.
C) int n[5] = {1; 2; 3; 4; 5};.
D) int n = new int(1, 2, 3, 4, 5);.
A) int[] n = {1, 2, 3, 4, 5};.
B) array n[int] = {1, 2, 3, 4, 5};.
C) int n[5] = {1; 2; 3; 4; 5};.
D) int n = new int(1, 2, 3, 4, 5);.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
13
Attempting to access an array element outside of the bounds of an array, causes a(n) .
A) ArrayOutOfBoundsException.
B) ArrayElementOutOfBoundsException.
C) ArrayIndexOutOfBoundsException.
D) ArrayException.
A) ArrayOutOfBoundsException.
B) ArrayElementOutOfBoundsException.
C) ArrayIndexOutOfBoundsException.
D) ArrayException.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
14
What do the following statements do?
Double[] array;
Array = new double[14];
A) Create a double array containing 13 elements.
B) Create a double array containing 14 elements.
C) Create a double array containing 15 elements.
D) Declare but do not create a double array.
Double[] array;
Array = new double[14];
A) Create a double array containing 13 elements.
B) Create a double array containing 14 elements.
C) Create a double array containing 15 elements.
D) Declare but do not create a double array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following statements about arrays are true?
A) An array is a group of variables containing values that all have the same type.
B) Elements are located by index.
C) The length of an array c is determined by the expression
A) A, C, D.
B) A, B, D.
C) C, D.
C)length();. D. The zeroth element of array c is specified by c[0].
D) A, B, C, D.
A) An array is a group of variables containing values that all have the same type.
B) Elements are located by index.
C) The length of an array c is determined by the expression
A) A, C, D.
B) A, B, D.
C) C, D.
C)length();. D. The zeroth element of array c is specified by c[0].
D) A, B, C, D.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
16
Reference-type variables (called references) store ________ in memory.
A) the value of an object
B) a copy of an object
C) the location of an object
D) the size of an object
A) the value of an object
B) a copy of an object
C) the location of an object
D) the size of an object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following statements is false?
A) An exception indicates a problem that occurs while a program executes.
B) Exception handling enables you to create fault-tolerant programs that can resolve (or handle) exceptions-in many cases, this allows a program to continue executing as if no problems were encountered.
C) The catch block contains the code that might throw an exception, and the try block contains the code that handles the exception if one occurs.
D) Inside the catch block, you can use the parameter's identifier to interact with a caught exception object.
A) An exception indicates a problem that occurs while a program executes.
B) Exception handling enables you to create fault-tolerant programs that can resolve (or handle) exceptions-in many cases, this allows a program to continue executing as if no problems were encountered.
C) The catch block contains the code that might throw an exception, and the try block contains the code that handles the exception if one occurs.
D) Inside the catch block, you can use the parameter's identifier to interact with a caught exception object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following statements is false?
A) A primitive-type variable can store exactly one value of its declared type at a time.
B) Primitive-type instance variables are initialized by default.
C) Variables of types byte, char, short, int, long, float and double are initialized to 0.
D) Variables of type boolean are initialized to true.
A) A primitive-type variable can store exactly one value of its declared type at a time.
B) Primitive-type instance variables are initialized by default.
C) Variables of types byte, char, short, int, long, float and double are initialized to 0.
D) Variables of type boolean are initialized to true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following statements about creating arrays and initializing their elements is false?
A) The new keyword should be used to create an array.
B) When an array is created with operator new, the number of elements must be placed in square brackets following the type of element being stored.
C) The elements of an array of integers have a value of null before they are initialized.
D) A for loop is commonly used to set the values of the elements of an array.
A) The new keyword should be used to create an array.
B) When an array is created with operator new, the number of elements must be placed in square brackets following the type of element being stored.
C) The elements of an array of integers have a value of null before they are initialized.
D) A for loop is commonly used to set the values of the elements of an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following will not produce a compiler error?
A) Changing the value of a constant after it is initialized.
B) Changing the value at a given index of an array after it is created.
C) Using a final variable before it is initialized.
D) All of the above will produce compiler errors.
A) Changing the value of a constant after it is initialized.
B) Changing the value at a given index of an array after it is created.
C) Using a final variable before it is initialized.
D) All of the above will produce compiler errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following tasks cannot be performed using an enhanced for loop?
A) Calculating the product of all the values in an array.
B) Displaying all even element values in an array.
C) Comparing the elements in an array to a specific value.
D) Incrementing the value stored in each element of the array.
A) Calculating the product of all the values in an array.
B) Displaying all even element values in an array.
C) Comparing the elements in an array to a specific value.
D) Incrementing the value stored in each element of the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
22
Assume array items contains the integer values 0, 2, 4, 6 and 8. Which of the following uses the enhanced for loop to display each value in array items?
A) for (int i = 0; i < items.length; i++)
System.out.prinf("%d%n", items[i]);
B) for (int i : items)
System.out.prinf("%d%n", items[i]);
C) for (int i : items)
System.out.prinf("%d%n", i);
D) for (int i = 0 : items.length)
System.out.prinf("%d%n", items[i]);
A) for (int i = 0; i < items.length; i++)
System.out.prinf("%d%n", items[i]);
B) for (int i : items)
System.out.prinf("%d%n", items[i]);
C) for (int i : items)
System.out.prinf("%d%n", i);
D) for (int i = 0 : items.length)
System.out.prinf("%d%n", items[i]);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
23
The preferred way to traverse a two-dimensional array is to use .
A) a do while statement.
B) a for statement.
C) two nested for statements.
D) three nested for statements.
A) a do while statement.
B) a for statement.
C) two nested for statements.
D) three nested for statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
24
In Java, multidimensional arrays ________.
A) are not directly supported.
B) are implemented as arrays of arrays.
C) are often used to represent tables of values.
D) All of the above.
A) are not directly supported.
B) are implemented as arrays of arrays.
C) are often used to represent tables of values.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which set of statements totals the items in each row of two-dimensional array items, and displays each row's total?
A) for (int row = 0; row < items.length; row++)
{
Int total = 0;
For (int column = 0; column < items[row].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
B) int total = 0;
For (int row = 0; row < items.length; row++)
{
For (int column = 0; column < items[row].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
C) int total = 0;
For (int row = 0; row < items.length; row++)
{
For (int column = 0; column < items[column].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
D) for (int row = 0; row < items.length; row++)
{
Int total = 0;
For (int column = 0; column < items[column].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
A) for (int row = 0; row < items.length; row++)
{
Int total = 0;
For (int column = 0; column < items[row].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
B) int total = 0;
For (int row = 0; row < items.length; row++)
{
For (int column = 0; column < items[row].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
C) int total = 0;
For (int row = 0; row < items.length; row++)
{
For (int column = 0; column < items[column].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
D) for (int row = 0; row < items.length; row++)
{
Int total = 0;
For (int column = 0; column < items[column].length; column++)
Total += items[row][column];
System.out.printf("Row %d's total is %d%n", row, total);
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following sets of statements creates a multidimensional array with 3 rows, where the first row contains 1 value, the second row contains 4 items and the final row contains 2 items?
A) int[][] items;
Items = new int[3][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
B) int[][] items;
Items = new int[3][];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
C) int[][] items;
Items = new int[?][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
D) int[][] items;
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
A) int[][] items;
Items = new int[3][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
B) int[][] items;
Items = new int[3][];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
C) int[][] items;
Items = new int[?][?];
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
D) int[][] items;
Items[0] = new int[1];
Items[1] = new int[4];
Items[2] = new int[2];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
27
When you pass an array or an individual array element of a reference type to a method, the called method receives ________. When you pass an individual element of a primitive type, the called method receives ________.
A) a copy of the element's reference, a copy of the element's reference
B) a copy of the element's value, a copy of the element's reference
C) a copy of the element's value, a copy of the element's value
D) a copy of the element's reference, a copy of the element's value
A) a copy of the element's reference, a copy of the element's reference
B) a copy of the element's value, a copy of the element's reference
C) a copy of the element's value, a copy of the element's value
D) a copy of the element's reference, a copy of the element's value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
28
An argument type followed by a(n) in a method's parameter list indicates that the method receives a variable number of arguments of that particular type.
A) square brackets ([])
B) ellipsis (...)
C) varargs keyword
D) All of the above are acceptable to indicate a variable number of arguments.
A) square brackets ([])
B) ellipsis (...)
C) varargs keyword
D) All of the above are acceptable to indicate a variable number of arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which statement correctly passes the array items to method takeArray? Array items contains 10 elements.
A) takeArray(items[]).
B) takeArray(items).
C) takeArray(items[9]).
D) Arrays cannot be passed to methods-each item must be sent to the method separately.
A) takeArray(items[]).
B) takeArray(items).
C) takeArray(items[9]).
D) Arrays cannot be passed to methods-each item must be sent to the method separately.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following statements is false?
A) When an argument is passed by reference, the called method can access the argument's value in the caller directly but cannot modify it.
B) All arguments in Java are passed by value.
C) To pass an individual array element to a method, use the indexed name of the array.
D) To pass an object reference to a method, simply specify in the method call the name of the variable that refers to the object.
A) When an argument is passed by reference, the called method can access the argument's value in the caller directly but cannot modify it.
B) All arguments in Java are passed by value.
C) To pass an individual array element to a method, use the indexed name of the array.
D) To pass an object reference to a method, simply specify in the method call the name of the variable that refers to the object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following statements creates a multidimensional array with 3 rows, where the first row contains 1 element, the second row contains 4 elements and the final row contains 2 elements?
A) int[][] items = {{1, null, null, null}, {2, 3, 4, 5}, {6, 7, null, null}};
B) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}};
C) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}, {});
D) int[][] items = {{1}, {4}, {2}};
A) int[][] items = {{1, null, null, null}, {2, 3, 4, 5}, {6, 7, null, null}};
B) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}};
C) int[][] items = {{1}, {2, 3, 4, 5}, {6, 7}, {});
D) int[][] items = {{1}, {4}, {2}};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following statements is true?
A) The catch block contains the code that might throw an exception.
B) The try block contains the code that handles the exception if one occurs.
C) You can have many catch blocks to handle different types of exceptions.
D) When a try block terminates, any variables declared in the try block are preserved.
A) The catch block contains the code that might throw an exception.
B) The try block contains the code that handles the exception if one occurs.
C) You can have many catch blocks to handle different types of exceptions.
D) When a try block terminates, any variables declared in the try block are preserved.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
33
Exception handling helps you create ________ programs.
A) high-performance
B) logic-error-free
C) fault-tolerant
D) compilation-error-free
A) high-performance
B) logic-error-free
C) fault-tolerant
D) compilation-error-free
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
34
An array with m rows and n columns is not ________.
A) an m-by-n array.
B) an n-by-m array.
C) a two-dimensional array.
D) a dual-transcripted array.
A) A and C.
B) A and D.
C) B and D.
D) B and C.
A) an m-by-n array.
B) an n-by-m array.
C) a two-dimensional array.
D) a dual-transcripted array.
A) A and C.
B) A and D.
C) B and D.
D) B and C.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which statement below initializes array items to contain 3 rows and 2 columns?
A) int[][] items = {{2, 4}, {6, 8}, {10, 12}};
B) int[][] items = {{2, 6, 10}, {4, 8, 12}};
C) int[][] items = {2, 4}, {6, 8}, {10, 12};
D) int[][] items = {2, 6, 10}, {4, 8, 12};
A) int[][] items = {{2, 4}, {6, 8}, {10, 12}};
B) int[][] items = {{2, 6, 10}, {4, 8, 12}};
C) int[][] items = {2, 4}, {6, 8}, {10, 12};
D) int[][] items = {2, 6, 10}, {4, 8, 12};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
36
When an argument is passed by reference, ________.
A) a copy of the argument's value is passed to the called method
B) changes to the argument do not affect the original variable's value in the caller
C) the called method can access the argument's value in the caller directly and modify that data
D) the original value is removed from memory
A) a copy of the argument's value is passed to the called method
B) changes to the argument do not affect the original variable's value in the caller
C) the called method can access the argument's value in the caller directly and modify that data
D) the original value is removed from memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
37
6.2 Q1 Which of the following statements is false?
A) A catch block declares a type and an exception parameter name.
B) Inside the catch block, you can use the parameter's name to interact with a caught exception object.
C) When a program is executed, array element indices are checked for validity-all indices must be greater than 0 and less than or equal to the length of the array.
D) If an attempt is made to use an invalid index to access an element, an ArrayIndexOutOfBoundsException exception occurs.
A) A catch block declares a type and an exception parameter name.
B) Inside the catch block, you can use the parameter's name to interact with a caught exception object.
C) When a program is executed, array element indices are checked for validity-all indices must be greater than 0 and less than or equal to the length of the array.
D) If an attempt is made to use an invalid index to access an element, an ArrayIndexOutOfBoundsException exception occurs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
38
In array items, which expression below accesses the value at row 3 and column 4?
A) items[3].[4]
B) items[3[4]]
C) items[3][4]
D) items[3, 4]
A) items[3].[4]
B) items[3[4]]
C) items[3][4]
D) items[3, 4]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
39
Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with the method call changeArray(items, items[2]), what values are stored in items after the method has finished executing?
Public static void changeArray(int[] passedArray, int value)
{
PassedArray[value] = 12;
Value = 5;
}
A) 0, 2, 5, 6, 12.
B) 0, 2, 12, 6, 8.
C) 0, 2, 4, 6, 5.
D) 0, 2, 4, 6, 12.
Public static void changeArray(int[] passedArray, int value)
{
PassedArray[value] = 12;
Value = 5;
}
A) 0, 2, 5, 6, 12.
B) 0, 2, 12, 6, 8.
C) 0, 2, 4, 6, 5.
D) 0, 2, 4, 6, 12.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
40
For the array that was the correct answer in the previous question, what is the value returned by items[1][0]?
A) 4.
B) 8.
C) 12.
D) 6.
A) 4.
B) 8.
C) 12.
D) 6.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following statements about an arc is false?
A) An arc is a section of an oval.
B) The sweep is the amount of arc to cover.
C) Method drawArc draws the edges of an arc.
D) The fillArc method draws an oval, with the section that is an arc filled in.
A) An arc is a section of an oval.
B) The sweep is the amount of arc to cover.
C) Method drawArc draws the edges of an arc.
D) The fillArc method draws an oval, with the section that is an arc filled in.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
42
Class Arrays methods sort, binarySearch, equals and fill are overloaded for primitive-type arrays and Object arrays. In addition, methods __________ and __________ are overloaded with generic versions.
A) sort, binarySearch.
B) sort, fill.
C) binarySearch, equals.
D) binarySearch, fill.
A) sort, binarySearch.
B) sort, fill.
C) binarySearch, equals.
D) binarySearch, fill.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following is false?
A) The size of an ArrayList can be determined via its length instance variable.
B) The size of an ArrayList can be determined via its size method.
C) You can add a new item to the end of an ArrayList with its add method.
C) You can get an item from a specified index in an ArrayList with its get method.
A) The size of an ArrayList can be determined via its length instance variable.
B) The size of an ArrayList can be determined via its size method.
C) You can add a new item to the end of an ArrayList with its add method.
C) You can get an item from a specified index in an ArrayList with its get method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
44
Class ________ represents a dynamically resizable array-like data structure.
A) Array
B) ArrayList
C) Arrays
D) None of the above.
A) Array
B) ArrayList
C) Arrays
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which command below runs TestProgram, and passes in the values files.txt and 3?
A) java TestProgram files.txt 3.
B) java TestProgram files.txt, 3.
C) java TestProgram "files.txt", "3".
D) None of the above.
A) java TestProgram files.txt 3.
B) java TestProgram files.txt, 3.
C) java TestProgram "files.txt", "3".
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which method call converts the value in variable stringVariable to an integer?
A) Convert.toInt(stringVariable)
B) Convert.parseInt(stringVariable)
C) Integer.parseInt(stringVariable)
D) Integer.toInt(stringVariable)
A) Convert.toInt(stringVariable)
B) Convert.parseInt(stringVariable)
C) Integer.parseInt(stringVariable)
D) Integer.toInt(stringVariable)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
47
Class Arrays provides method __________ for comparing arrays to determine whether they have the same contents.
A) compare
B) compares
C) equal
D) equals
A) compare
B) compares
C) equal
D) equals
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which method sets the background color of a JPanel?
A) setBack.
B) setBackground.
C) setBackgroundColor.
D) setColor.
A) setBack.
B) setBackground.
C) setBackgroundColor.
D) setColor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 48 في هذه المجموعة.
فتح الحزمة
k this deck