Visual Basic Chapter 6 Quiz
____ styles of combo boxes are available in Visual Basic.
Three
An argument in a calling statement can be literal, a named constant, a keyword, or a variable.
True
An independent Sub procedure is processed only when a statement in your code calls it.
True
You pass a variable ____ when the receiving procedure needs to know the variable's contents, but the receiving procedure does not need to change the contents.
by value
Which of the following statements will determine the number of items in the list portion of the Department combo box?
cboDepartment.Items.Count
A ____ is similar to a list box in that it allows the user to select from a list of choices.
combo box
The syntax ____ assigns a return value to a variable.
dblNewPrice = GetNewPrice(dblCurrentPrice)
Case-Based Critical Thinking Questions Case 1: MTN Outdoor You have just started working for MTN Outdoor as a programmer. Your first assignment is to review and correct various code to use sub procedures and/or functions. An application needs to calculate sales tax for purchases. You decide to simplify the code by putting the sales tax calculation in a function. The returned value from the function is then added to the Subtotal, and the result is stored in the decTotal variable. Which of the following statements will call the GetSalesTax function and return a value to be used in the Total calculation?
decTotal = decSubtotal + GetSalesTax(decSubtotal)
A(n) ____ is processed only when it is called (invoked) from code.
independent Sub procedure
Case-Based Critical Thinking Questions Case 1: MTN Outdoor You have just started working for MTN Outdoor as a programmer. Your first assignment is to review and correct various code to use sub procedures and/or functions. Which of the following statements would invoke the GetEndInventory function and assign the function's return value to the intEnd variable?
intEnd = GetEndInventory(intBegInv, intItemsSold, intReturned)
If the digits argument is omitted, the Math.Round function returns a(n) ____.
integer
The syntax ____ displays a return value.
lblNewPrice.Text = GetNewPrice(dblCurrentPrice).ToString("C2")
For the access key to work correctly in a combo box, you must set the label's TabIndex property to a value that is ____ the combo box's TabIndex value.
one less than
Like the first item in a list box, the first item in a combo box has an index of ____.
0
Usually, the statement that invokes a function will assign the function's return value to a(n) ____.
variable
It is a common practice to begin a procedure's name with a(n) ____.
verb
As you do with list boxes, you use the Items collection's ____ method to add an item to a combo box.
Add
The ____ keyword in a function header identifies the data type of the data being returned.
As
Case-Based Critical Thinking Questions Case 1: MTN Outdoor You have just started working for MTN Outdoor as a programmer. Your first assignment is to review and correct various code to use sub procedures and/or functions. Which of the following statements would invoke the DisplayMessage Sub procedure?
Call DisplayMessage(strItemName, decItemPrice)
The syntax of the Call statement is ____.
Call procedureName([argumentList])
The default combo box style in Visual Basic is ____.
DropDown
In a ____ combo box, the text portion is not editable.
DropDownList
A Function procedure does not return a value after performing its assigned task.
False
An event procedure is a Function procedure that is associated with a specific object and event.
False
Like a Sub procedure header, a Function procedure header includes the As dataType section.
False
Math.Round(3.234, 2) returns the number 3.24.
False
The names of the arguments in a Call statement need to be identical to the names of the corresponding parameters.
False
A form's ____ procedure is responsible for verifying that the user wants to close the application, and then taking the appropriate action based on the user's response.
FormClosing event
When using ____, you capitalize the first letter in the procedure name and the first letter of each subsequent word in the name.
Pascal case
Case-Based Critical Thinking Questions Case 1: MTN Outdoor You have just started working for MTN Outdoor as a programmer. Your first assignment is to review and correct various code to use sub procedures and/or functions. An application calculates an ending inventory amount based on a beginning inventory amount, sales, and returns. You need to create a function to calculate the ending inventory using three passed Integer variables: intBegin, intSales, and intReturns. Which of the following procedure headers should be used?
Private Function GetEndInventory(ByVal intBegin As Integer, ByVal intSales As Integer, ByVal intReturns As Integer) As Integer
Which of the following is a valid header for a procedure that receives the address of a string variable and the address of an integer?
Private Sub GetInfo(ByRef strName As String, ByRef intAge As Integer)
In most cases, the last statement within a function is the ____ expression.
Return
Which of the following is a valid Return statement?
Return dblNumber
To sort the items in the list portion of a combo box, you use the combo box's ____ property.
Sorted