# 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[]);

### + Submit Your Assignment Here

#### AssignmentHippo Features

##### On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

##### Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

##### 24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

##### Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

##### Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo

#### Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.