Test 4 CSCI 130 Spring 2003


  1. (3 points) Give the syntax for a do while statement.
  2. (3 points) State the flow of control for a do while statement.
  3. (3 points) Give the syntax for a for loop.
  4. (3 points) Write a while loop that simulates the behavior of a for loop.
  5. (3 points) Give three reasons for creating a function in a program.
  6. (3 points) Describe how parameters in the argument list must match parameters in the formal parameter list.
  7. (3 points) Write a value returning function which given the radius and height of a cylinder, returns the volume. (The volume of a cylinder is PI*radius2*height).
  8. (3 pts) Write a void function which given gross pay, calculates and returns net pay and taxes. Please use the following:
  9. (6 points) For the following program, do a functional decomposition, and design an algorithm. Give an outline of the program including stubs for any functions.

    Create a utility which given a file name, counts the number of lines, words and characters in that file, and prints the result to the screen.