- Declare a 2-D array with 5 columns and 2 rows (use constants).
- Draw out the following 2-D array:
int vals[3][2] = { 1,2,3,4,5,6 };
- Write a function that returns the maximum value in a 2-D array.
- Write a function that takes a 2-D array with 10 rows, 2 columns
and prints the sum of each row.
- Write a function that takes a 2-D array with 50 rows, 2 columns
and swaps the positions of each row.
- T/F: When using an array element, C performs bound checks on the value of the index.
- T/F: If an array has been declared as consisting of 10 elements and you use an index of 12, C will notify you of the error when the program is compiled.
- T/F: When passing a 2-D array to a function, the called function receives a copy of the array; this is because C uses pass by value.
- T/F: The outer braces in the initialization statement of a two-dimensional array can be omitted.
- T/F: Nested loops are especially useful when dealing with two-dimensional arrays because they allow the programmer to easily cycle through each element.
- T/F: Arrays of three, four, five, six, or more dimensions can be viewed as mathematical n-tuples of order three, four, five, six, and so on, respectively.
- A(n) ____, is used to store and process a set of values, all of the same data type, that forms a logical group.
a. data structure c. array
b. scalar variable d. atomic variable
- A ____ is a list of values of the same data type that is stored using a single group name.
a. one-dimensional array c. three-dimensional array
b. two-dimensional array d. matrix
- Each item in an array is called a(n) ____ of the array.
a. subscript c. index
b. variable d. element
- In a one-dimensional array in C, the first element has an index of ____.
a. NULL c. 0
b. -1 d. 1
- A two-dimensional array is sometimes referred to as a ____.
a. list c. queue
b. vector d. table
- ____ declares an array of three rows and four columns.
a. int val[3,4]; c. int val[3][4];
b. int val[4,3]; d. int val[4][3];
- The term ____ uniquely identifies the element in row 1, column 3.
a. val[3][1] c. val[3,1]
b. val[1][3] d. val[1,3]
- The initialization of a two-dimensional array is done in ____ order.
a. ascending c. row
b. descending d. column
- Write a function named getCol that takes 3 parameters:
(1) 2-D int array with NUMROWS and NUMCOLS for the number of rows and columns
(2) an int for the column number desired
(3) 1-D int array with space for NUMROWS elements
Function should modify the 1-D array to have the elements in the column
specified from parameter #2.
- Write a function that takes a 2-D array of integers and returns the maximum value
in the array (reference NROWS and NCOLS for # of rows and columns).
- T/F: When passing a 2-D array to a function, the function cannot change the original
array from the calling function.
- Build a crossword puzzle program, or a word search program.