Suppose that sales is a two-dimensional array of 10 rows and 7 columns wherein each component is of the type int. Which of the following correctly finds the sum of the elements of the fifth row of sales?

A. int sum = 0;
for(int j = 0; j < 7; j++)
    sum = sum + sales[5][j];
B. int sum = 0;
for(int j = 0; j < 7; j++)
    sum = sum + sales[4][j];
C. int sum = 0;
for(int j = 0; j < 10; j++)
    sum = sum + sales[5][j];
D. int sum = 0;
for(int j = 0; j < 10; j++)
    sum = sum + sales[4][j];


Answer: B

Computer Science & Information Technology

You might also like to view...

Select the false statement. If an exception is thrown from a constructor:

a. The object being constructed will not be constructed. b. For an array, destructors for all array elements are called, even if those array elements have not yet been constructed. c. The exception can contain the error information that the constructor would not be able to return in the normal manner. d. For an object with member objects, and whose outer object has not been constructed, the destructor is called for the member objects.

Computer Science & Information Technology

The column to the right of column Z is ________

A) A2 B) Z2 C) AA D) A27

Computer Science & Information Technology

When you need to create a form to match a paper form that you are already using-or when you need to create a form that doesn't match the appearance of a form that you can create with a form tool or the Form Wizard-you can create a blank form in Query view.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Flash source files have the ____ file extension.

a. FLA b. HTML c. SWF d. XML

Computer Science & Information Technology