Chapter 06 testbank

Chapter 06 testbank
Download Document
Showing pages : 1 - 2 of 11
This preview has blurred sections. Sign up to view the full version! View Full Document
Chapter 6 Multiple Choice Identify the letter of the choice that best completes the statement or answers the question. ____ 1. If you want to prevent statements from outside a form from accessing a procedure, you set the access specifier to in the procedure’s declaration. a. Private b. Public c. Static d. Scope ____ 2. If a procedure is called more than once in a program, the values stored in the procedure’s local variables will persist only if declared with the keyword. a. Const b. Public c. Static d. Dim ____ 3. A is a special variable in a Sub or Function heading that receives an argument’s value/address from a calling procedure. a. temporary variable b. constant c. original argument d. parameter ____ 4. Which of the following calls does not pass in valid arguments to the following GetANumber subprocedure? Sub GetANumber(ByVal intNumber as Integer) ' does some code End Sub a. GetANumber(intX) b. GetANumber(3 + 5 * 8 + intX) c. GetANumber(intX + 3, intY) d. GetANumber(Cint(txtNumber.Text)) ____ 5. When calling a Sub Procedure, the arguments and the corresponding parameters must agree in all of the following ways except one of the following. a. The order of arguments and parameters must correspond b. The names of the arguments and parameters must correspond c. The type the arguments and parameters must correspond d. the number of the arguments and the parameters must be the same Chapter 6 1
Background image of page 1
____ 6. Which of the following code is a correctly written function named Average that will accept three integers as parameters, calculate their average and return the result. a. Private Function Average(intX As Integer, intY As Integer, intZ As Integer) As Single Average = (intX + intY + intZ) / 3 End Function b. Private Function Average(ByVal intX As Integer, ByVal intY As Integer, _ ByVal intZ As Integer) As Single Average = intX + intY + intZ / 3 Return Average End Function c. Private Function Average( _ ByRef intX As Integer,ByRef intY As Integer, ByRef intZ As Integer, ByRef Average As Double) Average = (intX + intY + intZ)/3 End Function d. Private Function Average (ByVal intX As Integer,ByVal intY As Integer, _ ByVal intZ As Integer) As Single Return (intX + intY + intZ) / 3 End Function ____ 7. What is wrong with the following function? Public Function sum( ByVal intA As Integer, ByVal intY As Integer) As Integer
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.