Mastery Check

Please see the Questions and Answers for this section in Appendix A.

1. Which can only be called from a specific object, and cannot be called independently from an object?

a. Function b. Method c. Subroutine

2. Arguments have to be passed in the same order in which they are declared.

3. The data type of an argument passed has to be identical to the data type of the argument declared.

a. Always b. Never c. No, if the data type passed can be converted to the data type declared through a narrowing conversion d. No, if the data type passed can be converted to the data type declared through a widening conversion

4. What is the difference, if any, when returning the value of a function, between using the Return statement and assigning the return value to the function name?

a. Assigning the return value to the function name immediately ends execution of the function, whereas the Return statement does not.

b. The Return statement immediately ends execution of the function, whereas assigning the return value to the function name does not.

c. No difference.

5. Which way of calling a function will not enable you to use the function's return value?

a. Using the Call keyword b. Calling the function on the right side of an assignment statement or in an expression c. Calling the function in an expression

6. What is the effect, if any, that passing a scalar variable ByVal or ByRef as a procedure argument has on the called procedure's ability to modify the value of the variable passed as an argument in the calling code?

a. The called procedure may modify the value of a scalar variable if it is passed ByRef, but not if it is passed ByVal.

b. The called procedure may modify the value of a scalar variable if it is passed ByVal, but not if it is passed ByRef.

c. There is no effect.

7. What is the effect, if any, that passing an array variable ByVal or ByRef as a procedure argument has on the called procedure's ability to modify the value of the individual elements of the array passed as an argument in the calling code?

a. The called procedure may modify the individual elements of the array if the array is passed ByRef, but not if it is passed ByVal.

b. The called procedure may modify the individual elements of the array if the array is passed ByVal, but not if it is passed ByRef.

c. There is no effect.

8. What is the effect, if any, that passing an array variable ByVal o r ByRef as a procedure argument has on the called procedure's ability to change the array object pointed to by the array passed as an argument in the calling code?

a. The called procedure may change the array object pointed to by the array if the array is passed ByRef, but not if it is passed ByVal.

b. The called procedure may change the array object pointed to by the array if the array is passed ByVal, but not if it is passed ByRef.

c. There is no effect.

9. Which of the following statements is true?

a. Optional arguments may be declared with mandatory arguments in any order.

b. Optional arguments may be declared only before mandatory arguments.

c. Optional arguments may be declared only after mandatory arguments.

d. Optional arguments may not be declared with mandatory arguments.

10. You have to specify a value for an optional argument.

11. Which of the following statements is true?

a. A procedure must have a parameter array argument.

b. A procedure can have no more than one parameter array argument.

c. A procedure may have more than o ne parameter array argument.

d. A procedure may have both a parameter array argument and another optional argument.

12. Overloaded procedures must differ from each other in respect to a. Their access specifier b. Their argument list c. Their return value d. Whether arguments are passed ByVal or ByRef

Was this article helpful?

0 0

Post a comment