Test 2 CSCI 130 Summer 2013

  1. [4 points] What is functional decomposition?
  2. [6 points] Name three advantages of developing a program using functions. Explain why functions provide each of these advantages.
  3. [3 points] What is function cohesion?
  4. [4 points] Give the syntax for declaring a function prototype.
  5. [3 points] Describe the ways that the arguments in a function call and the formal parameters for that function must match.
  6. [6 points] Describe the difference between a parameter that is passed by reference and a parameter that is passed by value. Give an example that illustrates this difference and draw an illustration of your example. Explain what happens in your example function is invoked.
  7. [4 points] When is it appropriate to use a pass by value? When should a pass by reference be employed?
  8. [4 points] Write a function which takes an integer and returns three times that integer.
  9. [6 points] Write a void function which will take a string and return that string with all letters changed to upper case letters.
  10. [10 points] Write a function which given the temperature in Fahrenheit, converts it to Celsius. C=5/9(F-32). Write a complete program which uses this function. Your program should ask the user for a temperature in Fahrenheit and prints the corresponding temperature in Celsius.