# COMP 122 COMP122 Week 5 Homework Assignment Solution

COMP 122 Week 5 Homework

**Complete the following problems.**

1. Determine the value of the following expressions

2. Using the functions in the cmath library, write the following mathematical formulas as C++ expressions.

3. Consider the following functions:

4. Write a C++ function that has an input of a char value and returns true if the character is lower case or false otherwise.

5. Write a C++ function that has three inputs which are integers. The function returns true if the first number raised to the power of the second number equals the third number.

6. What is a function prototype? When is it needed?

7. What is the difference between an actual parameter and a formal parameter?

8. Explain the difference between pass by value parameters and pass by reference parameters.

9. Explain the difference between function parameters, local variables, and global variables regarding the parts of a program that can access these values.

10. What does **void** signify when used as the return type of a function?

11. What is the output of the following program fragment:

12. Write a C++ function which initializes its three reference parameters. The function should take an int, double, and string parameter and initialize them to 0 and the empty string (“”).