The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science

CSci 131 - Data Structures
Week 4 Homework

1. Write a type declaration for the following array types:

a. A string of unspecified length of upper case letters

b. Rainfall statistics which maintains the amount of rainfall for each hour of the day of each day of the month

c. An array of unspecified length of days of the week

d. A eight by eight checkerboard, where each square is a red checker, black checker, red king, black king or empty

2. Provide each of the following array aggregates:

a. A month with no rainfall using the type defined in 1b

b. An empty checker board using the type defined in 1d

3. Write a Put procedure that prints out the table of rainfall, as defined in 1b, for a given month. The hours of the day should be the columns of the table. The days of the month should be the rows.

4. Write a function that takes an array of the type defined in 1c as a parameter and returns a count of the number of Mondays in the array.

5. Assume that the checker board array, defined in 1d, is stored using row-major format. Also assume that the first element of the array is stored at memory location 1000 and that each square requires one byte of memory. At what memory location is the piece in the second row, seventh column stored?