Test 3 CSCI 130
Summer 2004
- 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.
- (8 points) Describe at least four ways procedures
make programming easier.
- (10 points) Give an outline of a C++ program which demonstrates each.
(Label each in your example)
- Function Prototype
- Function Call
- Function Definition
- Formal Parameter List
- Actual Parameter List
- ( 2 points) What is a parameter?
- ( 10 points) Describe and give examples of three ways the actual
parameter list must match the formal parameter list. Show
an example that does not meet each of the three conditions. Label
the problem with each example.
- (5 points) Describe the scope rules for resolving variable references
in C++.
- (5 points) Give an example of and describe when you would use a
parameter that is passed by reference and one that is passed by value.
- (5 points) Write a function which has three integers as input and
returns the floating point average of these three numbers.
- (10 points) Write a function which takes a string and a character
and removes all instances of that character from the string.