Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

____ 26. What is wrong with the following GetName procedure? Sub GetName(ByVal s

ID: 3802277 • Letter: #

Question

____ 26. What is wrong with the following GetName procedure? Sub GetName(ByVal strName As String) strName = InputBox(“Enter your Name:”) End Sub

a. The procedure is missing a Return statement.

b. GetName is a reserved word and cannot be used as a name of a procedure.

c. strName will be modified, but all changes will be lost when the procedure ends.

d. The syntax for the call to InputBox is incorrect.

____ 27. Which statement is not true regarding functions?

a. A function is a self-contained set of statements that can receive input values.

b. Visual Basic has many built-in functions such as CSng(txtInput.Text)

c. A function can only return a single value.

d. The same function can return several data types including integer, string, or double

____ 30. Which is the correct way to define a function named Square that receives an integer and returns an integer representing the square of the input value?

a. Function Square(ByVal intNum as Integer) As Integer Return intNum * intNum End Function

b. Function Square(ByVal intNum as Integer) Return intNum * intNum End Function

c. Function Square(ByVal intNum as Integer) As Double Return intNum * intNum End Function

d. Function Square(ByVal intNum as Integer) As Double Dim dblAns as Double dblAns = intNum * intNum Return dblAns End Function

Explanation / Answer

Answer 26

c. strName will be modified, but all changes will be lost when the procedure ends.

Answer 27

d. The same function can return several data types including integer, string, or double

Answer 30

a. Function Square(ByVal intNum as Integer) As Integer Return intNum * intNum End Function