You are on page 1of 3
8.14 Practice Sets Review Questions The type of all elements in an array must be the same. 1. The ty a. True b. False 2. Any expres a, True b. False When an array is defined, C automatically sets the value of its elements .ssion that evaluates to an integral value may be used as 2M ind, ted to zero. a, True b. False 4. When an array is passed to a function, C passes the value for each clemen, a. True b. False 5. Because of its efficiency, the binary search is the best search for any of its size and order. array, regardless a, True b. False 6. The selection, insertion, and bubble sort are all O(n?) sorts. a, True b. False 7. A(n) ——______ is an integral value used to access an elem in an array. . constant b. element ¢. index d. number ©. variable Scanned with CamScanner Chapter 8 Anoys 541 Which of the following array ini e . Which of the following statements concernin; zation stateme i a, int ary{ } = {1, 2,93, 4); ‘ments is valid? b. int ary[ ] = (1, 2, 3, 4); c, int ary{ ] = {1, 2, 3, 4); d, int ary{4} = (1, 2, 3, 4); e. int ary(4] = [1, 2, 3, 4); Which of the following statements assi ns the : first element on an array, ary? ns the value stored in x to the a. ary x b. ary x[0]; c. ary = x(ll; d. ary(0] = x; e,ary[1] = x; . 8 Passing array elements is true? a. Arrays cannot be passed to functions, because their structure is too complex! b. It is not possible to pass just a row of a two-dimensional array to a function. c. Only the size of the first dimension is needed when a two-dimensional array is declared in a parameter list. d. When an array is passed toa function, it is always passed by reference (only its address is passed). e, When a two-dimensional array is passed to a function, the size of the second dimension must be passed as a value parameter. - The process through which data are arranged according to their values is known as a. arranging b. listing ¢. parsing d, searching €. sorting The sort finds the smallest clement from. oe ini the Unsorted sublist and swaps it with the element at the beginning of Unsorted data. a. bubble - exchange ©. insertion 4. quick ©. selection Scanned with CamScanner I | I Section 8.14. Practice Sets ye h locates the target j 13. The ===> searre get item b, ° beginning and moving toward the end of the list. : “amg a. ascending b. binary c. bubble d. selection e. sequential 14. Which of the following statements about a sequential Search is fags se? n be searched using the sequential search, not found, every clement in the list is tested y of the sequential search is O(n). a, Any array b. If the target c. The efficiency d. The list must be ordered, e. The sequential search is generally recommended only for smallliss, 15. Which of the following statements about two-dimensional arrays is true ay can be thought of as an array of a a, A two-dimensional a: dimensional arrays. b. Only the size of the second dimension needs to be declared whent® array is used as a parameter. c. Two different types can be stored in a two-dimensional array. d, The first dimension is known as the column dimension. j . When passed to a function, the size of the second dimension mus passed as a value parameter. Scanned with CamScanner

You might also like