Final Exam CSCI 130
Summer 2011
- 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.
- [6 points] State at least three ways functions make better programs.
- [4 points] What is functional decomposition? How does this process work?
- [10 points] Give the outline of a program which includes a function. Give examples of, and clearly label each of the following:
- Function prototype
- Function call or invocation
- Function definition
- Parameter list
- Arguments
- [4 points] What is a value returning function and when might a programmer select to employ such a function?
- [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?
- [2 points] What is the scope of a variable?
- [5 points] Describe the flow of control for a function call.
- [5 points] Write a complete value returning function MaxInt which takes two integers and returns the larger of the two.
- [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'.