Checking Index Bounds and Initializing Arrays Question Answer (Circle the correc
ID: 3531971 • Letter: C
Question
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 [14];
a. 14
b. 15
int array [10];
array [10] = 5;
int array[5] = { 1, 2, 3};
What are the values of each array component?
4. The following code initializes each component to 0:
int array[3];
array[3] = {0};
5. The following code initializes each component to 0:
int array[3] = {0};
6. The following code correctly initializes each component to 0:
int array[3];
for (int count = 0; count <= 3; count++)
array[count] = 0;
7. The following code initializes each component to 0:
int array[3];
for (int count = 1; count <= 3; count++)
array[count] = 0;
Question
Answer
(Circle the correct answer)
1. How many components are contained in the following array declarations?
double values [14];
a. 14
b. 15
- The following statements assign 5 to the last value in the array.
int array [10];
array [10] = 5;
- Given:
int array[5] = { 1, 2, 3};
What are the values of each array component?
4. The following code initializes each component to 0:
int array[3];
array[3] = {0};
5. The following code initializes each component to 0:
int array[3] = {0};
6. The following code correctly initializes each component to 0:
int array[3];
for (int count = 0; count <= 3; count++)
array[count] = 0;
7. The following code initializes each component to 0:
int array[3];
for (int count = 1; count <= 3; count++)
array[count] = 0;
Explanation / Answer
a. 14
2. for (int x = 0; x < 5; x++)
sum += array[x];
3.is a structured data type
4.True
5.False
6.false
7.false
a. 14
2. for (int x = 0; x < 5; x++)
sum += array[x];
3.is a structured data type
4.True
5.False
6.false
7.false
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.