CSCI 131,

Fall 2003,

Test 1.


  1. [5 points] Describe the process of functional decomposition. Give at least two advantages of a functional decomposition.
  2. [2 points] Define an Abstract Data Type (ADT).
  3. [4 points] Give at least two reasons to use an ADT.
  4. [4 points] Describe object oriented design (OOD). How is this related to an ADT?
  5. [2 points] What is a struct in c++?
  6. [2 points] Why would a programmer use a struct? Give at least two reasons.
  7. [2 points] Give the syntax for declaring a struct in c++.
  8. [2 points] What is a class in c++?
  9. [2 points] Give the syntax for a class in c++.
  10. [4 points] Declare a struct that holds an employee id (int), an hourly wage (float), and the number of hours worked (int).
  11. [3 points] Write a procedure which takes an employee record (as above) and returns the amount the employee should be paid.
  12. [3 points] Design an ADT to represent a light switch. Make sure that you have operations to perform the basic functions of a light switch.
  13. [3 points] Implement your ADT above as a class.
  14. [2 points] Label the constructors, observers and transformers in your implementation of the light switch class.