Unit 6 and 7 Review Flashcards
What is the value of dblAnswer after the following code executes?
Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
Dim dblNum1, dblNum2, dblNum3, dblAnswer As Double
dblNum1 = 10
dblNum2 = 20
dblNum3 = 30
FindAverage(dblNum1, dblNum2, dblNum3, dblAnswer)
End Sub
Private Sub FindAverage(ByVal dblNumber1 As Double, ByVal dblNumber2 As Double, ByVal dblNumber3 As Double, ByRef dblAns As Double)
dblAns = (dblNumber1 + dblNumber2 + dblNumber3) / 3
End Sub
A. 20
B. 30
C. 10
D. 0
A. 20
Which would correctly call the sub procedure defined below?
Private Sub CalcTotalPrice (ByVal dblPrice As Double, ByVal intTaxRate As Integer,ByRef dblTotalPrice As Double)
A. dblTotalPrice = CalcTotalPrice(dblPrice, intTaxRate)
B. CalcTotalPrice(dblTotalPrice, intTaxRate, dblPrice)
C. CalcTotalPrice(dblPrice, intTaxRate, dblTotalPrice)
D. CalcTotalPrice(dblPrice, dblTotalPrice, intTaxRate)
C. CalcTotalPrice(dblPrice, intTaxRate, dblTotalPrice)
Given the following statements: Dim intX As Integer = 0 Me.lblAnswer.Text = Math.Sign(intX) What is displayed in the label? A. 1 B. 0 C. -1 D. intX
B. 0
What is the result of the following code?
strNumEntered = “Five”
Result = Int16.TryParse(strNumEntered, intTest)
A. Result = False, intTest = 5
B. Result = False, intTest = 0
C. Result = True, intTest = 0
D. Result = True, intTest = 5
B. Result = False, intTest = 0
Assuming that a ListBox named lstAnswer exists, which statement correctly adds an item to the ListBox? A. lstAnswer.Item.Add("Answer") B. lstAnswer.AddItems("Answer") C. lstAnswer.Items.Add = "Answer" D. lstAnswer.Items.Add("Answer")
D. lstAnswer.Items.Add(“Answer”)
Which event should be used with a MenuStrip?
A. .Click
B. Selected
C. Changed
D. .CheckChanged
A. .Click
Which best describes the purpose of function procedures?
A. To alter arguments after they have been passed
B. To perform a specific task and then return one value
C. They must be called from another procedure using the CALL statement
D. To perform several related tasks
B. To perform a specific task and then return one value
What are the variables called that are shown in the procedure header for a SUB procedure?
A. Parameters
B. Constants
C. Arguments
D. Values
A. Parameters
Which statement would correctly read input in from an InputBox into the string variable
A. strNumerator = InputBox(“Enter a numerator”, “Numerator”)
B. InputBox(“Enter a numerator”, “Numerator”) = strNumerator
C. intNumerator = InputBox(“Enter a numerator”, “Numerator”)
D. strNumerator InputBox(“Enter a numerator”, “Numerator”)
A. strNumerator = InputBox(“Enter a numerator
Which segment of code will correctly test a Boolean expression to see if input from a TextBox can beconverted to an double?
A. If Double.TryParse(txtInput.Text, dblNum) Then
B. If TryParse. Double(dblNum, txtInput) Then
C. If TryParse(txtInput.Text, dblNum) Then
D. If TryParse. Double(txtInput.Text, dblNum) Then
A. If Double.TryParse(txtInput.Text, dblNum) Then
Which is the correct syntax to declare the function CalcNum’s header?
A. Function CalcNum (ByVal intNum1 As Integer, ByVal intNum2 As Integer) As Integer
B. Sub CalcNum (ByVal intNum1 As Integer, ByVal intNum2) As Integer
C. Function CalcNum (ByRef intNum1 As Integer, ByVal intNum2 As Integer) As Intege
D. Function CalcNum (ByVal intNum1 As Integer, ByVal intNum2 As Integer)
A. Function CalcNum (ByVal intNum1 As Integer, ByVal intNum2 As Integer) As Integer
Which statement will return True if the user selects the Yes button of a Message Box?
Selected Answer:
A. If MessageBox.Show(“Would you like to continue?”, “Continue”,MessageBoxButtons.YesNo)=DialogResult.Yes
B. If MessageBox.Show(“Would you like to continue?”, “Continue”, MessageBoxButtons.YesNo) =Result.Yes
C. If MessageBox.Show(“Would you like to continue?”, “Continue”, MessageBoxButtons.YesNo = OK)
If MessageBox.Show(“Would you like to continue?”, “Continue”, MessageBoxButtons.YesNo) =DialogResult.No
A. If MessageBox.Show(“Would you like to continue?”, “Continue”,MessageBoxButtons.YesNo)=DialogResult.Yes
Given the function header, which statement below is written to correctly call the function? Function calcTotalPrice (ByVal dblPrice As Double, ByVal intQuantity As Integer) As Double A. calcTotalPrice(intQuantity, dblPrice) B. dblAnswer = calcTotalPrice(dblPrice, dblTaxRate, intQuantity) C. dblAnswer (calcTotalPrice(intQuantity, dblPrice)) D. dblAnswer = calcTotalPrice(intQuantity, dblPrice)
D. dblAnswer = calcTotalPrice(intQuantity, dblPrice)
Which correctly calls a function procedure? A. Call Function (strGrade) B. strGrade=GPA(numDouble ) C. Call GPA() Function D. Function = GPA( )
B. strGrade=GPA(numDouble )
What is the value of dblGPA after the following statement executes if the value 3.10 is entered into theTextBox?
blnAnswer = Double.TryParse(txtGPAInput.Text, dblGPA)
A. There is not enough information to determine.
B. 3.1
C. “3.10”
D. 0
B. 3.1