CSCI 131,
Fall 2003,
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.
- [5 points] Describe the process of functional decomposition. Give
at least two advantages of a functional decomposition.
- [2 points] Define an Abstract Data Type (ADT).
- [4 points] Give at least two reasons to use an ADT.
- [4 points] Describe object oriented design (OOD). How is this related
to an ADT?
- [2 points] What is a struct in c++?
- [2 points] Why would a programmer use a struct? Give at least two
reasons.
- [2 points] Give the syntax for declaring a struct in c++.
- [2 points] What is a class in c++?
- [2 points] Give the syntax for a class in c++.
- [4 points] Declare a struct that holds an employee id (int), an
hourly wage (float), and the number of hours worked (int).
- [3 points] Write a procedure which takes an employee record (as above)
and returns the amount the employee should be paid.
- [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.
- [3 points] Implement your ADT above as a class.
- [2 points] Label the constructors, observers and transformers in your
implementation of the light switch class.