CSCI 330 Midterm Spring 2022


  1. Dynamic Memory
    1. [9 points] There are three basic memory problems that can be encountered with raw pointers. Name and describe each.
    2. [6 points] A class containing dynamic memory requires three member functions. Name these functions and list the memory problems each mitigates.
  2. Abstract Data Type
    1. [3 points] What is an abstract data type (ADT)?
    2. [3 points] Describe the ADT vector. (In terms of an ADT)
  3. Design
    1. [4 points] Describe object oriented or bottom up design. Why is each of these terms applicable to this design methodology?
  4. Exceptions
    1. [2 points] What are exceptions?
    2. [9 points] Give the syntax and semantics for the C++ structures designed to handle exceptions. (3 components)
    3. [4 points] C++ provides an exception hierarchy. What does this mean? How is this useful?
  5. Code
    Given the following definition of a NodeT
    struct NodeT {
       DataT data;
       NodeT * next;
    }; 
    1. [4 points] Write a function which takes a pointer to the first element of a properly formed linked list of NodeT and frees all associated memory.
    2. [6 points] Write a function which takes a pointer to the first element of a properly formed linked list of NodeT, makes a deep copy and returns a pointer to that copy.