Test 2 CSCI 130
Summer 2013
- Please answer each question fully, carefully and thoughtfully.
- No credit will be given for unreadable answers, please write neatly.
- Answer the questions in any order, but please number each answer.
- Make sure that your name is on your test.
- [4 points] What is functional decomposition?
- [6 points] Name three advantages of developing a program using functions. Explain why functions provide each of these advantages.
- [3 points] What is function cohesion?
- [4 points] Give the syntax for declaring a function prototype.
- [3 points] Describe the ways that the arguments in a function call and the formal parameters for that function must match.
- [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.
- [4 points] When is it appropriate to use a pass by value? When should a pass by reference be employed?
- [4 points] Write a function which takes an integer and returns three times that integer.
- [6 points] Write a void function which will take a string and return that string with all letters changed to upper case letters.
- [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.