1. (TCO 1) Assume you have the following declaration: char nameList[100]; which
ID: 3531787 • Letter: 1
Question
1.(TCO 1) Assume you have the following declaration:char nameList[100];which of the following ranges is valid for the index of the array nameList?(Points : 4) 0 through 99
0 through 100
1 through 100
1 through 101
2.(TCO 1) What is stored in alpha after the following code executes?
int alpha[5] = {0};
int j;
for (j = 0; j < 5; j++)
{
alpha[j] = j + 5;
if ( j % 2 == 1) //see if j is an even number
alpha[j - 1] = alpha[j] + 2;
}(Points : 4) alpha = {5, 6, 7, 8, 9}
alpha = {5, 6, 10, 8, 9}
alpha = {8, 6, 7, 8, 9}
alpha = {8, 6, 10, 8, 9}
3.(TCO 1) Suppose that gamma is an array of 50 components of type int and j is an int variable. Which of the following for loops sets the index of gamma out of bounds?(Points : 4) for (j = 0; j < 50; j++)
for (j = 1; j <50; j++)
for (j = 0; j <=50; j++)
for (j = 0; j <=49; j++)
4.(TCO 1) Consider the following declaration:
int alpha[5] = {3, 5, 7, 9, 11};
Which of the following is equivalent to this statement?(Points : 4) int alpha[] = {3, 5, 7, 9, 11};
int alpha[] = {3 5 7 9 11};
int alpha[5] = [3, 5, 7, 9, 11];
int alpha[] = (3, 5, 7, 9, 11);
5.(TCO 1) Suppose alpha is an array of 50 components. Which of the following about alpha is true?
(i) The base address of alpha is the address of alpha[0].
(ii) The base address of alpha is the address of alpha[1].(Points : 4) Only (i)
Only (ii)
Both (i) and (ii)
None of these
6.(TCO 1) Consider the statement:
int list[10][8];
Which statement about list is true?(Points : 4) list has 10 rows andeight columns.
list haseight rows and 10 columns.
list has a total of 18 components.
list has a total of 108 components.
7.(TCO 1) Given the following declaration:
int j;
int sum;
double sale[10][7];
which of the following correctly finds the sum of the elements of the fifth row of sale?(Points : 4) sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[5][j];
sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[4][j];
sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[j][4];
sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[j][5];
8.(TCO 1) Considering the following statement:
double alpha[10][5];
what is the last row and column element of the array?(Points : 4) alpha[10][5]
alpha[9][4]
alpha[10][4]
alpha[9][5]
9.(TCO 2) A public member function of a class can access(Points : 4) only other public members of the class.
public and nonpublic members of a class.
only private members of a class.
neither public nor private class members.
10.(TCO 2) The member functions of a class should usually be(Points : 4) public.
private.
protected.
templates.
1.(TCO 1) Assume you have the following declaration:
char nameList[100];which of the following ranges is valid for the index of the array nameList?(Points : 4) 0 through 99
0 through 100
1 through 100
1 through 101
Explanation / Answer
1.0 through 99
2.alpha = {5, 6, 10, 8, 9}
3.for (j = 0; j <=50; j++)
4.int alpha[] = {3, 5, 7, 9, 11};
5.Only (i)
6.list has 10 rows andeight columns.
7.sum = 0;
for(j = 0; j < 7; j++)
sum = sum + sale[4][j];
8.alpha[9][4]
9.public and nonpublic members of a class.
10.Public
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.