Test 2 CSCI 130 Fall 2016


  1. [6 points] Integers
    1. Name the five basic integer types.
    2. How does the unsigned reserved word modify these types?
    3. What is the basic relationship between these types?
  2. [6 points] Floating Point Numbers
  3. [4 points] Describe the operation of both integer division and integer modulus.
  4. [4 points] Describe the bool data type.
  5. [4 points] Define type casting or conversion as well as coercion.
  6. [2 points each] Describe the operation of the following functions
    1. setw(int n)
    2. double pow(double x, double y)
    3. cin.ignore(int n, char c)
    4. getline(istream s, string w)
  7. [4 points] Describe how the stream extraction operator performs when attempting to read into a floating point variable.
  8. [4 points] Describe the error which frequently occurs when getline is used following the use of a stream extraction operator.
  9. [10 points] Write a complete c++ program which prompts the user for a number of seconds and prints out the corresponding Hours, Minutes and Seconds. For example, if the input is 3603, the output should be
    3603 seconds = 1 hour, 1 minute and 3 seconds.