1) What is stored in the list array after the following code executes? int list[
ID: 3570391 • Letter: 1
Question
1) What is stored in the list array after the following code executes?
int list[6];
for(int j = 0; j < 6; j++)
{
list[j] = 3 * j + 3;
if (j % 2 == 0)
{
list[j] = list[j] - 3;
}
}
Answer:
2). Write C++ statements to define and initialize the following arrays using appropriate data types:
a. An array of weights has 3 components which have the values: 121, 152, 98.
b. An array of symbols which contains the following characters: '?', '!', '&'.
3). Given the following declaration, what is stored in the 5th element of the array?
int list[5] = {1, 2, 3};
Answer:
4) Write a C++ function which initializes its two reference parameters. The function should take an int, and string parameter and initialize them to 10 and
Explanation / Answer
1 ) list[0] = 0 list[1] = 6 list[2] = 6 list[3] = 12 list[4] = 12 list[5] = 18
2 ) a) int array = { 121, 152, 98 }; b) char array2 = { '?', '!', '&' };
3 ) garbage value
4) void functi( int n, char * str )
{
n =10;
*s =
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.