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

(True/False) When debugging a program in break mode, the Step Into command cause

ID: 3802300 • Letter: #

Question

(True/False) When debugging a program in break mode, the Step Into command causes the currently
highlighted line of code to execute.
a. True
b. False

Which of the following code examples is a function that will accept three integer parameters, calculate their
average, and return the result?
a. Function Average(ByVal intX As Integer, ByVal intY As Integer, _
ByVal intZ As Integer) As Single

Average = (intX + intY + intZ) / 3
End Function

b. 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. 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. Function Average(ByVal intX As Integer, ByVal IntY as Integer, _
ByVal intZ As Integer) As Single

Return (intX + intY + intZ) / 3
End Function

14. If we were to call the MakeDouble and ChangeArg methods shown below, using the following statements,
what value would be assigned to lblResult.Text?
a. 0
b. 20
c. 40
d. (cannot be determined)

Dim intValue As Integer = 20
ChangeArg(intValue)
lblResult.Text = MakeDouble(intValue).ToString()

Function MakeDouble (ByVal intArg As Integer) As Integer
    Return intArg * 2
End Function
Sub ChangeArg2(ByRef intArg As Integer)
' Display the value of intArg.
lstOutput.Items.Add(" ")
lstOutput.Items.Add("Inside the ChangeArg procedure, " &
"intArg is " & intArg.ToString())
lstOutput.Items.Add("I will change the value of intArg.")
' Assign 0 to intArg.
intArg = 0
' Display the value of intArg.
lstOutput.Items.Add("intArg is now " & intArg.ToString())
lstOutput.Items.Add(" ")
End Sub

Explanation / Answer

When debugging a program in break mode, the Step Into command causes the currently
highlighted line of code to execute.

Ans-True

Explaination:-When an application is in Break mode, the Step Into command causes the currently highlighted line (the execution point) to execute. If that line contains a call to a procedure or function, the next highlighted line is the first line in that procedure or function. In other words, the Step Into command allows you to single-step through a procedure or function when it is called.

Which of the following code examples is a function that will accept three integer parameters, calculate their
average, and return the result?

Ans- d. Function Average(ByVal intX As Integer, ByVal IntY as Integer, _
ByVal intZ As Integer) As Single
Return (intX + intY + intZ) / 3
End Function

Explaination- This function has the return value as (intX + intY + intZ) / 3 which gives the average.

14. If we were to call the MakeDouble and ChangeArg methods shown below, using the following statements,
what value would be assigned to lblResult.Text?

Ans-b. 20

explaination- Function MakeDouble (ByVal intArg As Integer) As Integer
Return intArg * 2
End Function
This function will return the value 20.
lblResult.Text stores MakeDouble(intValue).ToString()