# CSC102 Ch 8 Quiz

Total word count: 1177
Pages: 4

### Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
 n-dimensional array A collection of a fixed number of elements (called components) arranged in n dimensions (n>=1) is called a(n) ____. 0 1 1 2 2 3 After the following statements execute, what are the contents of matrix? int matrix; int j, k; for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) matrix[j][k] = j + k; True T/F? All components of an array are of the same data type. False T/F? Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference. 0 through 99 Assume you have the following declaration char nameList;. Which of the following ranges is valid for the index of the array nameList? 0 through 999 Assume you have the following declaration double salesData;. Which of the following ranges is valid for the index of the array salesData? beta Assume you have the following declaration int beta;. Which of the following is a valid element of beta? a. beta[‘2′] b. beta[’50’] c. beta d. beta strcpy(str, "Blue Sky"); Consider the following declaration: char str;. Which of the following statements stores "Blue Sky" into str? int alpha[] = {3, 5, 7, 9, 11}; Consider the following declaration: int alpha = {3, 5, 7, 9, 11};. Which of the following is equivalent to this statement? discard = ‘\n’ Consider the following declaration: char charArray; char discard; Assume that the input is: Hello There! How are you? What is the value of discard after the following statements execute? cin.get(charArray, 51); cin.get(discard); a. discard = ‘ ‘ (Space) b. discard = ‘\n’ c. discard = ‘\0’ d. discard = ‘!’ 50 Consider the following statement: double alpha;. The number of components of alpha is ____. Rows of alpha are numbered 0…24 and columns are numbered 0…9. Consider the following statement: int alpha;. Which of the following statements about alpha is true? a. Rows of alpha are numbered 0…24 and columns are numbered 0…9. b. Rows of alpha are numbered 0…24 and columns are numbered 1…10. c. Rows of alpha are numbered 1…24 and columns are numbered 0…9. d. Rows of alpha are numbered 1…25 and columns are numbered 1…10. list has 10 rows and 8 columns. Consider the statement int list;. Which of the following about list is true? a. list has 10 rows and 8 columns. b. list has a total of 18 components. c. list has a total of 108 components. d. list has 8 rows and 10 columns. selection For a list of length n, the ____________________ sort makes exactly (n(n – 1))/2 key comparisons and 3(n-1) item assignments. False T/F? Given the declaration int list; the statement list = list + list; updates the content of the twelfth component of the array list. sum = 0; for(j = 0; j < 7; j++) sum = sum + sale[j]; Given the following declaration: int j; int sum; double sale; Which of the following correctly finds the sum of the elements of the fifth row of sale? sum = 0; for(j = 0; j < 10; j++) sum = sum + sale[j]; Given the following declaration: int j; int sum; double sale; Which of the following correctly finds the sum of the elements of the fourth column of sale? False T/F? If an array index goes out of bounds, the program always terminates in an error. ‘\0’ In C++, the null character is represented as ____. True T/F? In a two-dimensional array, the elements are arranged in a table form. structured In a(n) ____________________ data type, each data item is a collection of other data items. first row is stored first In row order form, the ____. a. first row is stored last b. first row is stored first c. first column is stored first d. first column is stored last False T/F? Suppose list is a one dimensional array of size 25, wherein each component is of type int. Further, suppose that sum is an int variable. The following for loop correctly finds the sum of the elements of list. sum = 0; for (int i = 0; i < 25; i++) sum = sum + list; for (j = 0; j <= 50; j++) cout << gamma[j] << " "; Suppose that gamma is an array of 50 components of type int and j is an int variable. Which of the following for loops sets the index of gamma out of bounds? a. for (j = 0; j <= 50; j++) cout << gamma[j] << " "; b. for (j = 1; j < 50; j++) cout << gamma[j] << " "; c. for (j = 0; j <= 48; j++) cout << gamma[j] << " "; d. for (j = 0; j <= 49; j++) cout << gamma[j] << " "; for (int j = 0; j <= 9; j++) cout << list[j] << " "; cout << endl; Suppose that list is an array of 10 components of type int. Which of the following codes correctly outputs all the elements of list? for (int j = 0; j <= 49; j++) sales[j] = 0.0; Suppose that sales is an array of 50 components of type double. Which of the following correctly initializes the array sales? base address The ____________________ of an array is the address (that is, the memory location) of the first array component. False T/F? The array index can be any integer less than the array size. range-based The form of the for loop shown below is called a(n) ____________________ for loop. for (dataType identifier : arrayName) statements True T/F? The one place where C++ allows aggregate operations on arrays is the input and output of C-strings. False T/F? The statement int list; declares list to be an array of 26 components, since the array index starts at 0. const The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array. 10 8 6 4 2 What is the output of the following C++ code? int alpha = {2, 4, 6, 8, 10}; int j; for (j = 4; j >= 0; j–) cout << alpha[j] << " "; cout << endl; 0 5 10 15 20 What is the output of the following C++ code? int list = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j] << " "; cout << endl; Code results in index out-of-bounds What is the output of the following C++ code? int list = {0, 5, 10, 15, 20}; int j; for (j = 1; j <= 5; j++) cout << list[j] << " "; cout << endl; 5 What is the value of alpha after the following code executes? int alpha; int j; for (j = 0; j < 5; j++) alpha[j] = 2 * j + 1; True T/F? When you pass an array as a parameter, the base address of the actual array is passed to the formal parameter. int alpha = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}}; Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the component type int? a. int alpha = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}}; b. int alpha = {0,1,2: 1,2,3: 2,3,4: 3,4,5}; c. int alpha = {0,1,2; 1,2,3; 2,3,4; 3,4,5}; d. int alpha = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}}; char name = "William"; Which of the following correctly declares name to be a character array and stores "William" in it? int alpha; Which of the following statements declares alpha to be an array of 25 components of the type int?

### More flashcards like this

#### NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

#### NCLEX 300-NEURO

A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

#### NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

## Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price 