CS 2401 Quiz #2

Date: Monday, August 30, 2010.

1. Scheduling classes is difficult, let us help. Let an array capacity[i] contain the number of students that can fit into the i-th classroom, and let name[i] contain the name of the i-th classroom (e.g., "COMP 308"). We plan to have an interesting talk, and we expect a lot of students, so we need to find the largest classroom. Write down a piece of code that finds a classroom that fits the largest number of students and prints the name of this classroom.










































Trace this code on an example of 3 Computer Science classrooms COMP 321, COMP 308, and COMP 322, with capacities 30, 50, and 30 students.




































Turn over, please.

2. Please answer questions about the reading assignment:

2a. can an array be 2-dimensional?

2b. can an array be 3-dimensional?

2c. is it possible to have a 2-dimensional array with rows of different size?