COSC 1437 Chapter 8 Review Question
18. Which method in the ArrayList class can be used to place a value onto the end of the ArrayList?
Add()
20. Which class includes methods to create a dynamic one-dimensional structure?
ArrayList
1.when two numbers are contained within the square bracket the last number represents the number of
Coloums
3.Choose a statement that does not apply to the following declaration double[,] totalCostOfItems= {{109.95,169.95,1.50,89.95},{27.9,18.6,26.8,98,5}}
establishes the maximum number of rows as 4
6. use the following declarations char[,] n = {{'a','b','c','d','e'},{'f','g','h','i','j'}}; what does n[1,1] refer to?
g
2.Which of the following array declarations would enable you to store the high low temperatures for a week
int[,] temp = new temp[7,2];
14. with the following declaration int[.] point = {{300,100,200,400,600},{550,700,900,200,100}}; the statement points [0,4] = points[0,4-2]; will
replace the 600 with 200
13. with the following declaration int[,] points = {{300,100,200,400,600,},{550,700,900,800,100,}}; the statement points [1,3] = points[1,3] +10; will
replace the 800 amount with the 810
4.What valu is returned by the method named result int result(int [,] anArray{int j = 0,i=0;for (int r =0;r< anArray.GetLength(0);r++) for intc =0;c<anArray.GetLength(1);c++)if anArray[r,c]<anArray[i,j]){i = r;j = c;} returni;}
the row index of the smallest elelment fo array anArray
5.What is the largest dimension an array can be declared to store values?
there is no limit
11. Given the declaration for values in question #11 above, how would you store 0 in the last physical location?
values[2,1] = 0
9.Which of the following adds 95 to the array element that is currently storing 14? int[,,] x = {{12,13},{14,15},{16,17},{18,19}}
x[1,0]+=95;
10.How many compents are allocated by the following statement? double [.] values = new double [3,2];
6
A correct method call to a method that has the following heading would be: int result(int[,]anArray, int num)
Write(result(anArray, 3));
8. use the following declaration int[.] x= {{12,13,14,15},{16,17,18,19}}; what does x[2,4] refer to?
a 19 b 18 c'/0' d 0 e none of the above <-- correct answer
16.When you pass an element from an arraylist to method the method receives
a copy of the value in the element of the arraylist
19. Which member in the ArrayList class can be used to get or set the number of elements that an ArrayList can contain?
Dimesion
15. with the following declaration int[.] point = {{300,100,200,400,600},{550,700,900,200,100}}; the statement Write(points [1,2] = points[0,3]); will
Display 1300
17. To convert all the uppercase letters in a string to theri lowercase counterpart, you can use the _____ method of the string class
ToLower()
7. A two-dimensional array is a list of data items that
all have the same type
12. if you declare an array as int[,] anArray = new int [5,3]; you can double the value stored in anArray [2,1] with the statement:
anArray [2,1]*=2;
