This preview has intentionally blurred parts. Sign up to view the full document

View Full Document

Unformatted Document Excerpt

Starting Out with Visual Basic 2008, 4/E by Tony Gaddis/Kip Irvine TEST BANK Test Items prepared by George Dollar/Updated for 4/E by Iskandar Hack Chapter 6 Multiple Choice Identify the letter of the choice that best completes the statement or answers the question. __ a __ 1. If you want to prevent statements from outside a form from accessing a procedure, you set the access specifier to in the procedures declaration. a. Private b. Public c. Static d. Scope _ C ___ 2. If a procedure is called more than once in a program, the values stored in the procedures local variables will persist only if declared with the keyword. a. Const b. Public c. Static d. Dim __ D __ 3. A is a special variable in a Sub or Function heading that receives an arguments value/address from a calling procedure. a. temporary variable b. constant c. original argument d. parameter __ C __ 4. Which one of the given procedure calls does not pass in valid arguments to the following GetANumber subprocedure? Sub GetANumber(ByVal intNumber as Integer) ' (procedure body) End Sub a. GetANumber(intX) b. GetANumber(3 + 5 * 8 + intX) c. GetANumber(intX + 3, intY) d. GetANumber(Cint(txtNumber.Text)) __ B __ 5. When calling a procedure, the passed arguments and the declared 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 types of the arguments and parameters must correspond d. the number of arguments and the number of parameters must be the same Chapter 6 38 Starting Out with Visual Basic 2008, 4/E by Tony Gaddis/Kip Irvine TEST BANK Test Items prepared by George Dollar/Updated for 4/E by Iskandar Hack _ D ___ 6. Which of the following code examples is a correctly written function that will accept three integer parameters, calculate their average, and return the result? a. Private Function Average(intX As Integer, intY As Integer, _ int Z 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... View Full Document

End of Preview

Sign up now to access the rest of the document