Exam 6: Procedures and Functions
Exam 1: Introduction to Programming and Visual Basic40 Questions
Exam 2: Creating Applications With Visual Basic36 Questions
Exam 3: Variables and Calculations41 Questions
Exam 4: Making Decisions39 Questions
Exam 5: Lists and Loops36 Questions
Exam 6: Procedures and Functions31 Questions
Exam 7: Multiple Forms, Modules, and Menus35 Questions
Exam 8: Arrays and More34 Questions
Exam 9: Files, Printing, and Structure36 Questions
Exam 10: Working With Databases32 Questions
Exam 11: Developing Web Applications33 Questions
Exam 12: Classes, Collections, and Inheritance36 Questions
Select questions type
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)
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)