CS 2401 Quiz #2

Date: Monday, January 31, 2011.

1. Which of the following topics are covered in the chapter that you were assigned to read (answer Y/N for each topic):

2. Write a method that, given a 2-D array and a row index, returns the sum of all elements of the given row. Trace how your method will work when we use it to compute the sum of Row 1 in the following array:

 1  2
 3  4
Hints: The result should be 3 + 4 = 7. The method should be applicable to a 2-D array of any size. Do not forget that to make a method work, you must call it; show how you call it.