Test II, CSCI 230, Spring 2020


  1. ADT:

    An abstract data type (ADT) is defined as a datatype whose properties (domain and operations) are specified independently of any particular implementation. Given that a class is the way an ADT is implemented in c++,

    1. [6 points] List and describe mechanisms provided by the c++ class structure to implement an ADT. How do these mechanisms support development of an ADT?
    2. [6 points] Discuss the implications of this definition for the implementer of a class in c++.
    3. [2 points] Discuss the implications of this definition for the client of a class in c++.
  2. [4 points] Why does class scope extend to all instances of a class? Give an example.
  3. [6 points] Describe the basic differences between procedural programming and object oriented programming.
  4. In terms of a c++ class,
    1. [2 points] What is a constructor?
    2. [2 points] What are the responsibilities of a constructor?
    3. [2 points] When is a constructor invoked?
  5. [5 points] You are implementing a design that calls for a class with no observers or transformers. The design specifies that all data should be public. Critique this design.
  6. Selection Sort
    1. [4 points] Describe in English the operation of Selection Sort.
    2. [2 points] Draw a diagram using ASCII art discussing the state of the array after a number of passes of the main loop of Selection Sort. This diagram should support the answer in part A.
      • you might, for example, use UUUUUUUUUUUU to represent an unsorted array.
      • Make sure you explain what your diagram(s) mean.
    3. [4 points] Discuss the performance of Selection Sort.
  7. [5 points] A file contains a series of integers, one per line. Write a function which takes the file name and returns the number of integers contained in the file.

Submission Instructions