Test I, CSCI 230, Fall 2009


  1. [6 points] Describe at least three reasons to construct programs from many small functions.
  2. [4 points] Describe the information that should be placed in an implementation and a specification file.
  3. [10 points] Describe the compilation process. Describe the component processes involved and the files produced at each stage. Draw a diagram.
  4. [5 points] Define Abstract Data Type (ADT)
  5. [3 points] What is information hiding?
  6. [3 points] What is encapsulation?
  7. [3 points] What is a struct in C++?
  8. [3 points] What is a class in C++?
  9. [3 points] Give the syntax for declaring a class in C++.
  10. [2 points] Give the syntax for declaring an instance of a class in C++.
  11. [3 points] When employing classes, when is memory allocated?
  12. [5 points each] For a quiz program, a question class consists of a question (string), an answer (bool), and a score (int). This class should support operations to create the class, set the question, get the question, set the answer, get the answer, set the score and get the score.
    1. Provide the code for the specification file for this class.
    2. Provide the code for the implementation file for the member functions to create the class, set the question and get the score.
    3. Provide a code snippet which will declare an instance of this class, set the question to "The age of reason began in 55 BCE when Cesar invaded Britain", the answer to false and the score to 0.
    4. Provide a complete routine which is passed an instance of your class, asks the question, checks the answer, and sets the score to be 1 if the answer is correct.