Test 3 CSCI 130 Summer 2013

  1. [1 point each]
    1. What is an identifier?
    2. For what are identifiers used?
    3. Name three rules for creating identifiers.
    4. Give conventions for creating identifiers.
  2. [4 points] Describe how the standard input stream and an input file are similar and how they are different.
  3. [1 point each]
    1. What is the result of x = 3/6?
    2. What is the result of x = 3.0/6?
    3. What is happening to make these results different? Describe the process.
    4. If both a and b are integers, how can you find a/b as a floating point number.
  4. [4 points] Give the data type and member functions, along with parameters, needed to read data from a file. Describe all operations involved in this process.
  5. For each of the following control structures
    1. [1 point] Give the syntax
    2. [1 point] Give the preferred form
    3. [2 points] Describe the flow of control.
  6. [3 points] Write a function which takes an integer between 0 and 9 and returns the English name of that integer.
  7. [4 points] What three conditions are necessary for constructing a successful loop? How does the syntax of the for loop help programmers meet these conditions?
  8. [5 points] Write a function which takes a target string and an object string and counts the number of times the object string occurs in the target string. For example if the target string is "A day and A half", and the object string is "A", the function would return 2.
  9. [10 points] Write a program which will read the data stored in numbers.data. Your program should print the number of numbers, the maximum and the minimum value, along with the average. The data stored in this file consists of floating point numbers, which are separated by white space.