CSCI 230,
Fall 2006,
Test 1.
- The weight of each question is given with the question
- Use as much paper as you wish, but make your answers are legible.
- Please answer each question thoughtfully and carefully.
- (4 points) What is functional decomposition?
- (6 points) Name/describe two advantages of writing many small
functions to solve a problem.
- (5 points) What is an array?
- (5 points) What is a record (or struct)?
- (5 points) Compare (state how they are the same) and contrast
(state how they are different) arrays and records.
- (3 points) Give the syntax to declare an array.
- (3 points) Give the syntax to declare a structure.
- (2 points) Declare an array of integers which can hold 7 integers.
- (2 points) Declare a structure that holds a boolean and a character.
- (10 points) Write a routine that takes an array of floats, and the size of the array and returns the minimum value in the array.
- (10 points) Write a routine that takes an array of structures, as declared above, and the size of the array. This routine should initialize the boolean field to false and the character field to the letter corresponding to the
entry number. (A for record 0, B for record 1, ...). There will be at most
26 entries in the array.
- (5 points) Declare a structure that can hold an array of floats, an integer
that represents the size of the array. The maximum size of the array is 10 entries.
- (10 points) Write a routine that takes the structure from the previous
problem and prints the values of the array, 5 per line, for all valid
entries in the array.
- (5 points) What is an array index out of bounds error? Describe two (different) things that can happen when an array out of bounds error occurs.