Final Exam CSCI 130 Summer 2011

  1. [6 points] State at least three ways functions make better programs.
  2. [4 points] What is functional decomposition? How does this process work?
  3. [10 points] Give the outline of a program which includes a function. Give examples of, and clearly label each of the following:
  4. [4 points] What is a value returning function and when might a programmer select to employ such a function?
  5. [8 points] What is the difference between pass by reference and pass by value? Give an example of each, which is clearly labeled. When should a programmer employ pass by reference?
  6. [2 points] What is the scope of a variable?
  7. [5 points] Describe the flow of control for a function call.
  8. [5 points] Write a complete value returning function MaxInt which takes two integers and returns the larger of the two.
  9. [6 points] Write a complete void function which given a string and a command letter, changes the string to all upper case letters if the command letter is 'U', and all lower case letters if the command letter is 'L'.