CSCI 230,

Fall 2006,

Test 1.


  1. (4 points) What is functional decomposition?
  2. (6 points) Name/describe two advantages of writing many small functions to solve a problem.
  3. (5 points) What is an array?
  4. (5 points) What is a record (or struct)?
  5. (5 points) Compare (state how they are the same) and contrast (state how they are different) arrays and records.
  6. (3 points) Give the syntax to declare an array.
  7. (3 points) Give the syntax to declare a structure.
  8. (2 points) Declare an array of integers which can hold 7 integers.
  9. (2 points) Declare a structure that holds a boolean and a character.
  10. (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.
  11. (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.
  12. (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.
  13. (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.
  14. (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.