Exam 6: Procedures and Functions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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?

(Multiple Choice)
4.7/5
(33)

What is wrong with the following GetName procedure? Sub GetName(ByVal strName As String) StrName = InputBox("Enter your Name:") End Sub

(Multiple Choice)
4.9/5
(36)

When a procedure finishes execution, __________.

(Multiple Choice)
4.9/5
(38)

Which of the following does not apply to procedures and functions?

(Multiple Choice)
4.8/5
(36)

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

(True/False)
4.8/5
(43)

Although you can omit the ByVal keyword in a parameter variable declaration, it is still a good idea to use it.

(True/False)
4.9/5
(38)

Which statement is not true regarding functions?

(Multiple Choice)
4.8/5
(41)

What is incorrect about the following function? Function sum(ByVal intX As Integer, ByVal intY As Integer) As Integer Dim intAns As Integer IntAns = intX + intY End Function

(Multiple Choice)
5.0/5
(37)

If we were to call the MakeDouble and ChangeArg methods shown below, using the following statements, what value would be assigned to lblResult.Text? 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

(Multiple Choice)
4.9/5
(41)

What will be the value of dblSum after the button btnAdd is clicked, assuming that 25 is entered by the user into txtNum1, and 35 is entered into txtNum2? Private Sub btnAdd_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnAdd.Click Dim dblNum1, dblNum2, dblSum As Double DblNum1 = CDbl(txtNum1.Text) DblNum2 = CDbl(txtNum2.Text) DblSum = Sum(dblNum1, dblNum2) LblSum.Text = dblSum.ToString() End Sub Function Sum(ByVal dblNum1 As Double, ByVal dblNum2 As Double) as Double Return dblNum1 + dblNum2 End Function

(Multiple Choice)
4.7/5
(43)

Which one of the following declarations uses Pascal casing for the procedure name?

(Multiple Choice)
4.9/5
(29)
Showing 21 - 31 of 31
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)