Test II, CSCI 230, Spring 2013


  1. [5 points] Give the definition for Abstract Data Type (ADT).
  2. [2 points] How are ATDs implemented in C++?
  3. [4 points] Describe at least two common errors which can be prevented by using classes.
  4. [2 points] What is information hiding?
  5. [4 points] What is an array? Name two properties of an array.
  6. [3 points] Give the syntax for declaring an array. NOTE ALL restrictions.
  7. [2 points] What is an array index out of bounds error?
  8. [3 points] What are the potential results of an array index out of bounds error?
  9. [2 points] What is the effect of declaring a member item of a class private?
  10. [5 points] Draw a diagram which represents program compilation involving myClass.h, myClass.cpp and main.cpp. Your diagram should include the following terms. Place a rectangle around processes and underline files. System Library
    PreprocessorSystem Header File Object File Executable
    Compiler Linker Source Code
  11. [2 points] Describe how an array is passed as a parameter.
  12. [3 points] Show how an array be passed so that the values can not be changed. Explain your example.
  13. [5 points] Write a function which takes an array of integers, and the size of the array , and returns the sum of the values in the array.
  14. [3 points] Give the three conditions necessary to successfully write a recursive function.
  15. [5 points] Write a recursive function to calculate the next triangular number T(n).
    T(n) = | 1, n=1
    | n+T(n-1), n>1