Description
DeVry COMP 122 Week 6 Homework Latest
Week 6 Homework
Complete the following problems.
- 1.Write C statements to do the following:
- a.Declare an array alpha of 15 components of type int.
- b.Output the value of the 10thcomponent of the alpha array.
- c.Set the value of the 5thcomponent of the alpha array to 35.
- d.Set the value of the 9thcomponent of the alpha array to the sum of the 6th and 13th components of the alpha array.
- e.Set the value of the 4thcomponent of the alpha array to three times the value of the 8th component minus 57.
- f.Output alpha so that five components appear on each line.
- 2.What is stored in the list array after the following code executes?
int list[5];
for(int j = 0; j < 5; j )
{
list[j] = 2 * j 5;
if (j % 2 == 0)
{
list[j] = list[j] – 3;
}
}
- 3.What does array index out of bounds mean? What can happen if this occurs in your program?
- 4.Write C statements to define and initialize the following arrays using appropriate data types:
- a.An array of heights has 6 components which have the following values: 5.5, 5.8, 6.3, 6.6, 4.9, 5.9.
- b.An array of weights has 4 components which have the values: 140, 165, 190, 207.
- c.An array of symbols which contains the following characters: ‘$’, ‘%’, ‘@’, ‘!’, ‘|’, ‘&’.
- d.An array of the seasons which contains “Spring”, “Summer”, “Fall”, “Winter”.
- 5.Given the following declaration, what is stored in the 8thelement of the array?
int list[10] = {1, 2, 3, 4, 5};
- 6.When an array is passed as an actual parameter to a function, what is really being passed in to the function? Why are arrays passed this way?
- 7.Write a for loop to initialize the following array (int data[10]) with the values 10, 9, 8… 1.
- 8.Given an array of 10 doubles named data, write a loop that loads the array with user input.
- 9.Given an array of 100 doubles named data, write a loop that creates the sum of all the array elements.
- 10.Write a loop that finds the smallest element in an integer array called data containing 100 elements.
DeVry Courses helps in providing the best essay writing service. If you need 100% original papers for DeVry COMP 122 Week 6 Homework Latest, then contact us through call or live chat.
DeVry COMP 122 Week 6 Homework Latest

Reviews
There are no reviews yet.