Exam 8: Arrays and Strings

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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

Free
(Short Answer)
4.8/5
(29)
Correct Answer:
Verified

12
twelve

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

Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
Verified

A

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

Free
(True/False)
4.9/5
(35)
Correct Answer:
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;

(Multiple Choice)
4.9/5
(30)

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?

(Multiple Choice)
4.8/5
(29)

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?

(Multiple Choice)
4.7/5
(35)

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

(Short Answer)
4.8/5
(39)

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

(Short Answer)
4.9/5
(34)

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

(Multiple Choice)
4.9/5
(30)

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

(True/False)
4.9/5
(38)

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;

(Multiple Choice)
4.8/5
(30)

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

(Short Answer)
4.9/5
(43)

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

(Multiple Choice)
4.9/5
(30)

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

(Multiple Choice)
5.0/5
(37)

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

(True/False)
4.8/5
(35)

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

(Multiple Choice)
4.8/5
(26)

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

(Short Answer)
4.8/5
(33)

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

(Multiple Choice)
5.0/5
(39)

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

(True/False)
5.0/5
(35)

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);

(Multiple Choice)
5.0/5
(45)
Showing 1 - 20 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)