Chapter 6 - Arrays
When you declare an array as int[] temperature = {0, 32, 50, 90, 212, 451};, the value of temperature.Length is _____________________.
b. 6 (how many elements are in it
Which of the following traits do the BinarySearch() and Sort() methods have in common?
b. Both methods belong to the System.Array class.
The BinarySearch() method is inadequate when ________________.
b. The array holds duplicate values and you want to find them all.
In an array, every element has the same __________.
b. data type
Assume an array is defined as int[] nums = {2, 3, 4, 5};. Which of the following would display the values in the array in reverse?
b. for (int x = 3; x >= 0; --x) Write(nums[x]);
Initializing an array is _______________ in C#.
b. optional
When an ages array is correctly initialize using {20, 30, 40, 50}, as in Question 8, then the value of ages[1] is _____________.
c. 30 (life begins at 0)
If you define an array to contain 10 elements, then the highest array subscript you can use is _________________.
c. 9
Assume an array is defined as int[] nums = {7, 15, 23, 5};. Which of the following would place the values in the array in descending numeric order?
c. Array.Sort(nums); Array.Reverse(nums); (sort THEN reverse)
Which of the following doubles every value in a 10-element integer array named amount?
c. both of these for(int x = 9; x >=0; --x) *=2; and foreach(int number in amount) *=2;
The operator used to create objects is _________.
c. new
If you use the BinarySearch() method, and the object you seek is not found in the array, ______________.
d. A negative value is returned.
Which of the following correctly declares an array of six integers?
d. Int[] array = new int[6];
The value placed within square brackets after an array name is ______________.
d. all of the above (a subscript, an index and always an integer)
Which of the following correctly declares an array of four integers?
d. all of these (all contain 4 integers)
Which of the following declares an integer array that contains eight rows and five columns?
d. int [ , ] num = new int [8, 5]
Which of the following adds 10 to every value in a 16-element integer array named points?
d. neither of these (a goes above known universe (> not <) and b says points not sub)
Two arrays that store related information in corresponding element positions are _____________.
d. parallel arrays
When an ages array is correctly initialize using {20, 30, 40, 50}, as in Question 8, then the value of ages[4] is _____________.
d. undefined (since life begins at 0, 3 is the highest option)
When you declare an array of six double elements but provide no initialization values, the value of the first element is ________________.
d. unknown (nothing is declared in new array)