Filters
Question type

Study Flashcards

In the following declaration, the array gamma has ____________________ components. int gamma[5][6][10];

Correct Answer

verifed

verified

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 fourth column of sale?


A) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[j][3];
B) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[j][4];
C) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[j][4];
D) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[j][3];

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

Which of the following correctly declares and initializes alpha to be an array of four rows and three columns with the component type int?


A) int alpha[4][3] = {{0,1,2} {1,2,3} {2,3,4} {3,4,5}};
B) int alpha[4][3] = {0,1,2; 1,2,3; 2,3,4; 3,4,5};
C) int alpha[4][3] = {0,1,2: 1,2,3: 2,3,4: 3,4,5};
D) int alpha[4][3] = {{0,1,2}, {1,2,3}, {2,3,4}, {3,4,5}};

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

The following statement creates alpha to be a two-dimensional array with ____________________ rows. int alpha[10][25];

Correct Answer

verifed

verified

Consider the following statement: double alpha[10][5];. The number of components of alpha is ____.


A) 15
B) 50
C) 100
D) 150

E) C) and D)
F) A) and C)

Correct Answer

verifed

verified

Assume you have the following declaration char nameList[100];. Which of the following ranges is valid for the index of the array nameList?


A) 0 through 99
B) 0 through 100
C) 1 through 100
D) 1 through 101

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

A

All components of an array are of the same data type.

A) True
B) False

Correct Answer

verifed

verified

True

What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) \quad cout << list[j] << " "; cout << endl;


A) 0 1 2 3 4
B) 0 5 10 15
C) 0 5 10 15 20
D) 5 10 15 20

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

Which of the following correctly declares name to be a character array and stores "William" in it?


A) char name[6] = "William";
B) char name[7] = "William";
C) char name[8] = "William";
D) char name[8] = 'William';

E) C) and D)
F) A) and B)

Correct Answer

verifed

verified

The statement int list[25]; declares list to be an array of 26 components, since the array index starts at 0.

A) True
B) False

Correct Answer

verifed

verified

Consider the following declaration: int alpha[5] = {3, 5, 7, 9, 11};. Which of the following is equivalent to this statement?


A) int alpha[] = {3, 5, 7, 9, 11};
B) int alpha[] = {3 5 7 9 11};
C) int alpha[5] = [3, 5, 7, 9, 11];
D) int alpha[] = (3, 5, 7, 9, 11) ;

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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?


A) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[5][j];
B) sum = 0;
For(j = 0; j < 7; j++)
Sum = sum + sale[4][j];
C) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[5][j];
D) sum = 0;
For(j = 0; j < 10; j++)
Sum = sum + sale[4][j];

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Consider the following declaration: char charArray[51]; char discard; Assume that the input is: Hello There! How are you? What is the value of discard after the following statements execute? cin.get(charArray, 51) ; cin.get(discard) ;


A) discard = ' ' (Space)
B) discard = '!'
C) discard = '\n'
D) discard = '\0'

E) A) and D)
F) A) and B)

Correct Answer

verifed

verified

Arrays can be passed as parameters to a function by value, but it is faster to pass them by reference.

A) True
B) False

Correct Answer

verifed

verified

After the following statements execute, what are the contents of matrix? int matrix[3][2]; Int j, k; For (j = 0; j < 3; j++) For (k = 0; k < 2; k++) Matrix[j][k] = j + k;


A) 0 0
1 1
2 2
B) 0 1
2 3
4 5
C) 0 1
1 2
2 3
D) 1 1
2 2
3 3

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

In a two-dimensional array, the elements are arranged in a table form.

A) True
B) False

Correct Answer

verifed

verified

Consider the statement int list[10][8];. Which of the following about list is true?


A) list has 10 rows and 8 columns.
B) list has 8 rows and 10 columns.
C) list has a total of 18 components.
D) list has a total of 108 components.

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

The word ____________________ is used before the array declaration in a function heading to prevent the function from modifying the array.

Correct Answer

verifed

verified

For a list of length n, the ____________________ sort makes exactly (n(n - 1))/2 key comparisons and 3(n-1) item assignments.

Correct Answer

verifed

verified

The declaration char str[] = "Hello there"; declares str to be a string of ____________________ characters.

Correct Answer

verifed

verified

12 twelve

Showing 1 - 20 of 50

Related Exams

Show Answer