Test I, CSCI 230, Spring 2011
- The weight for 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] Describe functional decomposition.
- [6 points] Your roommate stated "User defined functions and procedures slow the program down, so we shouldn't use them." Comment in depth on this statement.
- [3 points] What problem does an enumerated type solve?
- [3 points] Give the syntax for declaring an enumerated type.
- [3 points] Declare an enumerated type to represent the months of the year.
- [3 points] Describe any code you would create to support the enumerated type in the above question.
- [3 points] What is a structure (struct)?
- [2 points] When should a programmer employ a struct?
- [3 points] Give the syntax for a struct.
- [3 points] Declare a struct to hold a standard date (day, month, year)
- [3 points] Describe any code that you would create to support the struct in the previous question.
- [2 points] Write a routine which will initialize your struct to Jan 1, 1970.
- [10 points] Write a routine which will take a string in the form Month-day-year and place the data in your struct. In this format Month is the full month name, day is an integer and year is an integer. For example, January-1-1970 is valid data. Provide code for any support routines used.
- [2 points] Describe the use of the typedef statement.