Midterm Exam, CSCI 330, Fall 2020


  1. Relationships: for the relationships Shared Aggregation, Composition, Inheritance.
  2. Object Design
  3. [4 points] Describe the ADT vector. List domain and operations.
    The domain of a vector is 0 or more items of the given type. These items are maintained in the "locations" they are inserted. Operations on a vector include:
    • Adding elements to he end of the vector(push_back)
    • Indexing into a vector ([])
    • removing elements from a vector (erase).
    I am simply checking to see if you can provide a reasonable list of operations on a vector, it does not need to be exhaustive, alto you could achieve that with a simple copy and paste from cplusplus.com.
  4. Iterators
  5. [4 points] Describe the operation of the new [] operator in C++.
    New allocates memory on the heap and returns a pointer to that memory. This is specifically for the creation of an array of items as new[n] will allocate n locations big enough to hold an instance of the item type given.

    If the the item being created has a constructor, the constructor is called.

  6. Unit testing
    1. [2 points] What is a unit test?
      A unit test is a test which tests the behavior of an individual unit or section of software.
    2. [2 points] How can implementing unit tests during the design process improve the final product?
      By designing unit tests early in the software design process the designer may
      • Gain better insight into the requirements for the unit under design.
      • Gain a better understanding of special cases for the unit under design.
      • Helps provide a measurement of when the code is complete.
    3. [2 points] How can a test framework improve the software development process?
      • They provide assistance with design (see above)
      • They provide evidence that the code is working.
      • They provide a tool for locating and correcting bugs in later product development.
      • They provide examples of code use.
    4. [2 points] Describe how unit tests evolve during the software development process.
      Test should be developed to test for a robust set of conditions.

      As additional conditions are discovered during testing or use, these should be added to the unit test suite.

  7. [10 points] Complete the following program.
    Please see wordCountAnswer.cpp
        

Submission Instructions