## Study areas

#### GET ASSIGNMENT HELP # Declaring and Manipulating Data into Arrays

Arrays

Lab 9.1 Declaring and Manipulating Data into Arrays

 Question Answer(Circle the correct answer) 1. How many components are contained in the following array declarations? double values ; a. 14 b. 15 2. Write a for loop that sums the numbers in an array with 5 components. int sum = 0 for( int i=0; i<5; i++) sum+=array[i]; 3. An array _________________. a. is a simple data type b. is a structured data type 4. Simple data types are building blocks for arrays. yes 5. An array index starts at 1. no 6. In C++, array is a reserved word. no 7. The following code allows the size of an array to be determined at execution: int n; cout << “Enter the size of the array: “; cin >> n; int array[n]; yes

Lab 9.2 Checking Index Bounds and Initializing Arrays

 Question Answer(Circle the correct answer) 1. How many components are contained in the following array declarations? double values ; a. 14 b. 15 The following statements assign 5 to the last value in the array. int array ; array  = 5; No, Array=5; Given: int array = { 1, 2, 3}; What are the values of each array component? {1,2,3,0,0} 4. The following code initializes each component to 0: int array; array = {0}; No 5. The following code initializes each component to 0: int array = {0}; yes 6. The following code correctly initializes each component to 0: int array; for (int count = 0; count <= 3; count++) array[count] = 0; It does initializes each component too but because the array maximum index is 2 7. The following code initializes each component to 0: int array; for (int count = 1; count <= 3; count++) array[count] = 0; No, _IndexOutOf BoundException

Lab 9.3 Passing Arrays as Parameters to Functions

 Question Answer(Circle the correct answer) 1. Given the prototype: void function(int array); The formal parameter is an array of 5 elements. T When passing an array to a function, the size of the array is automatically passed. F 3. Given the declaration: int array; and the prototype: void function(int []); Which code calls a function with array as the argument? a. function (array); b. function (array[]); c. function (array); 4. Which prototype for a function reads in an integer array and returns the array to the calling function? a. int function(); b. int[] function(); c. void function(int array[]); d. void function(int &array[]);
Assignment Help Features
Assignment Help Services
• Assignment Help
• Homework Help
• Writing Help  