Visual Basic Final
Case-Based Critical Thinking Questions Case 1: BrainPower Tutoring The owner of BrainPower Tutoring needs an application that clients can use to request an appointment. The application should allow users to enter their name, subject, preferred appointment time, and phone number, and submit their request. It should also allow them to print their appointment request, clear the screen, and exit the application. The tutoring center has some clients with visual impairments, so the application should be easy for them to use. Which of the following statements is true about the user interface?
The interface should be designed using black text on a white background.
____ styles of combo boxes are available in Visual Basic.
Three
To specify a range of values in a Select Case statement's clause, use the _______ keyword when you know both the upper and lower values in the range.
To
Which of the following is a true statement?
To have the computer close the current form when the user clicks the Exit button, the Me.Close() statement should be entered in a button's Click event procedure .
A class definition is a block of code that specifies or defines an object's appearance and behavior.
True
A counter is always incremented by a constant value.
True
A named constant's value cannot be changed while the application is running.
True
A programmer must phrase the condition of a selection structure so that it results in either a true or a false answer only.
True
A variable declared using one of the numeric data types is automatically initialized to the number 0.
True
Access keys are not case sensitive.
True
Actions performed by the user such as clicking, double-clicking, and scrolling are known as events.
True
An independent Sub procedure is processed only when a statement in your code calls it.
True
Before using a string in a comparison, you can use either the ToUpper method or the ToLower method to convert the string to uppercase or lowercase, respectively, and then use the converted string in the comparison.
True
Calculations involving decimal variables are not subject to the small rounding errors that may occur when using double or single variables.
True
Comparison operators are always evaluated after arithmetic operators in a conditional expression.
True
If the intQuantity and decPrice variables contain the numbers 3 and 15.75, respectively, the condition If intQuantity > 0 AndAlso intQuantity < 10 OrElse decPrice > 20 will evaluate to ____.
True
It is best to use black text on a white, off-white, or light gray background.
True
Like the condition in a selection structure, the condition in a loop must evaluate to either True or False.
True
Tab order is the order in which each control receives the focus when the user presses the Tab key.
True
The And operator always checks both conditions, while the AndAlso operator does not always evaluate the second condition.
True
The Label control can be used to display information that you do not want the user to change during run time.
True
The Project Designer window allows you to verify the form that will display when the application starts.
True
The computer automatically processes an event procedure when the event occurs.
True
The expression 12 > 0 AndAlso 12 < 10 * 2 evaluates to True.
True
What is the value of the following expression: 9 * 2 - 8 > 5 + 2 / 2?
True
Consider the expression 3 * 2 ^ 2 < 16 + 5 AndAlso 100 / 10 * 2 > 15 - 3. Which operation is performed first?
^
Case-Based Critical Thinking Questions Case 1: XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. You changed the Do clause to the correct For clause in the previous problem. You also changed the Loop keyword to the Next keyword for the For...Next loop. What else needs to be changed about the Do loop?
a and b
Case-Based Critical Thinking Questions Case 1: Jack of All Trades You've been asked to design an application for Jack of All Trades, which rents small power equipment to commercial and residential customers, to process its transactions. The strCustomer variable will be used to determine whether a customer is commercial (C) or residential (R). Commercial customers receive a 10% discount if they are members of the Rental Rewards Program. Residential customers receive a 5% discount if they are members. The application needs to display a message box to remind the clerk to ask customers to join the Rental Rewards Program when they check out. This message box should only display if the customer is not currently in the program. Which of the following If clauses would evaluate to True and display the message box for the clerk?
a and c
When you click the ellipsis (...) button in the Settings box of the Font property, ____.
a dialog box opens
Which of the following is an example of an appropriate name for a control?
btnExit
When you pass a variable ____, the computer passes only the contents of the variable to the receiving procedure.
by value
Buttons are identified in an interface by their _________.
caption
Which of the following statements will determine the number of items in the list portion of the Department combo box?
cboDepartment.Items.Count
Case-Based Critical Thinking Questions Case 1: Jack of All Trades You've been asked to design an application for Jack of All Trades, which rents small power equipment to commercial and residential customers, to process its transactions. The strCustomer variable will be used to determine whether a customer is commercial (C) or residential (R). Commercial customers receive a 10% discount if they are members of the Rental Rewards Program. Residential customers receive a 5% discount if they are members. You meet with the manager of Jack of All Trades and she tells you that occasionally a customer requests more than one piece of equipment at the same time. She'd like to be able to handle all requests from a single customer in one transaction. Based on this feedback, you decide to use ____________ for equipment selection in the interface.
check boxes
Use the control's ____ property to determine whether a radio button or check box is selected or unselected.
checked
A ____ is similar to a list box in that it allows the user to select from a list of choices.
combo box
Case-Based Critical Thinking Questions Case 1 You have been hired to develop an application for Ridgeline Realty, a local real estate agency. The owner wants the application to display an image of the company logo and to say "Ridgeline Realty" in the title bar, and he doesn't want users to be able to change the size of the form. To create the Windows application for Ridgeline, you will first need to ____.
create a New Project and determine the directory for the solution
The syntax ____ assigns a return value to a variable.
dblNewPrice = GetNewPrice(dblCurrentPrice)
Which of the following statements adds the number stored in the decPrice variable to the number stored in the decSubtotal variable, and then assigns the result to the decSubtotal variable?
decSubtotal += decPrice
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)
Adding increments of a negative number is referred to as ____.
decrementing
The _________ symbol in a flowchart represents the condition in a selection structure.
diamond
The Solution Explorer window ____.
displays a list of the projects contained in the current solution
The Toolbox window ____.
displays the tools you use when creating your application's interface
A(n) __________ in the name of a form indicates a hierarchy of namespaces to allow the computer to locate the Form class in a computer's main memory.
dot member access operator
The last step in planning a Windows Form application is to ____.
draw a sketch of the user interface
Case-Based Critical Thinking Questions Case 1: XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. How many times will the message display based on the counter being initialized to 0? intCounter = 0 Do While intCounter < 5 MessageBox.Show("OK") intCounter = intCounter + 1 Loop
five
Case-Based Critical Thinking Questions Case 1: BrainPower Tutoring The owner of BrainPower Tutoring needs an application that clients can use to request an appointment. The application should allow users to enter their name, subject, preferred appointment time, and phone number, and submit their request. It should also allow them to print their appointment request, clear the screen, and exit the application. The tutoring center has some clients with visual impairments, so the application should be easy for them to use. How many buttons do you need for the application?
four
Case-Based Critical Thinking Questions Case 1: BrainPower Tutoring The owner of BrainPower Tutoring needs an application that clients can use to request an appointment. The application should allow users to enter their name, subject, preferred appointment time, and phone number, and submit their request. It should also allow them to print their appointment request, clear the screen, and exit the application. The tutoring center has some clients with visual impairments, so the application should be easy for them to use. How many text boxes do you need for the application?
four
You can use a(n) ____ to visually separate related controls from other controls on the form.
group box
A(n) ____ is processed only when it is called (invoked) from code.
independent Sub procedure
A unique number called a(n) ____ identifies each item in a collection.
index
In a nested repetition structure, one loop, referred to as the ____ loop, is placed entirely within another loop, called the ____ loop.
inner, outer
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
You should use a ____ control to provide keyboard access to a list box.
label
Use a ____ to display text that a user is not allowed to edit during run time.
label control
The syntax ____ displays a return value.
lblNewPrice.Text = GetNewPrice(dblCurrentPrice).ToString("C2")
In a For...Next statement, if stepValue is positive, the loop body is processed when the counter's value is ____ endValue.
less than or equal to
Programmers use a(n) ____ when they need the computer to repeatedly process one or more program instructions until some condition is met, at which time the ____ ends.
loop
Which of the following statements selects the "blue" item, which appears fourth in the lstColor control?
lstColor.SelectedIndex = 3
A(n) ____ is a predefined procedure that you can call (or invoke) when needed.
method
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
A(n) ____ error occurs when the value assigned to a memory allocation is too large for the location's data type.
overflow
The ___________ symbol in a flowchart represents input tasks and output tasks.
parallelogram
You can use ____ to override the arithmetic order of preference.
parentheses
Which of the following loop structures always executes at least once?
posttest
The loop created by the For...Next statement is a ____ loop.
pretest
Labels that display __________ typically have their AutoSize property set to False.
program output
Each object has a set of attributes, called ____, that determine the object's appearance and behavior.
properties
The ___________ symbol in a flowchart represents tasks such as ending the application and making calculations.
rectangle
The ____ of a variable indicates where the declared memory location can be used in an application's code.
scope
Consider the expression 3 * 2 ^ 2 < 16 + 5 AndAlso 100 / 10 * 2 > 15 - 3. Which operation is performed second?
*
In the mathematical expression 4 * 3 + 15 / 3 - 6, which operation is performed first?
*
The ____ operator is evaluated first in the following expression: 9 * 2 - 8 > 5 + 2 / 2.
*
When an application is started, Visual Basic 2017 will automatically create a file that has the project name and a(n) ____ file extension.
.exe
A Visual Basic 2017 solution file will have a(n) ____ file extension.
.sln
A memory variable that is a Double data type requires ____ bytes of storage.
8
The assignment operator in Visual Basic is the ____ symbol.
=
The ____ operator is evaluated last in the following expression: 9 * 2 - 8 > 5 + 2 / 2.
>
Which of the following statements assigns the contents of the txtGrade control, in uppercase, to the strGrade variable?
strGrade = txtGrade.Text.ToUpper
When an application is being designed for a company, Windows interface standards can be superseded by ______________.
the company's interface standards
In a group of buttons, which button should appear first?
the most commonly used
Aside from letters and numbers, a variable name in Visual Basic can only contain the _________ character.
underscore (_)
Each access key in an interface should be _____________.
unique
Usually, the statement that invokes a function will assign the function's return value to a(n) ____.
variable
A default button is identified by setting the form's ____ property.
AcceptButton
As you do with list boxes, you use the Items collection's ____ method to add an item to a combo box.
Add
An access key allows the user to select an object using the ____ key in combination with a letter or number.
Alt
A label control's ____ property determines whether the control automatically sizes to fit its current contents.
AutoSize
Logical operators are sometimes referred to as ____ operators.
Boolean
In Windows applications, a(n) ____ is commonly used to perform an immediate action when clicked.
Button
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])
When a button is selected, the computer processes the code contained in the button's ____ event procedure.
Click
The Backspace key is represented by the ____ constant.
ControlChars.Back
To start an application using the menu bar, you click ____ on the menu bar and then click Start Debugging.
DEBUG
Which of the following is not a commonly used property of a text box?
Description
The Windows ____ window allows you to create the graphical user interface for your application.
Designer
Which of the following statements declares a Double variable named dblAverage ?
Dim dblAverage As Double
Case-Based Critical Thinking Questions Case 1: PetPals You have been hired by PetPals Veterinary Clinic to modify an application. The application is used to enter and save all patient (pet) information obtained during an office visit. The pet's temperature is recorded at every visit, and it may contain a decimal place. What data type is best for storing this data?
Double
The default combo box style in Visual Basic is ____.
DropDown
The ____ function key will start a Visual Basic 2017 application in the IDE.
F5
A Function procedure does not return a value after performing its assigned task.
False
A variable declared in the Declaration section of a form is called a procedure-level variable.
False
A variable is a computer memory location where a programmer can permanently store an item of data while an application is running.
False
All controls have a TabIndex property.
False
An event procedure is a Function procedure that is associated with a specific object and event.
False
Data types and classes are not related to each other.
False
Even if none of a label control's events will be coded and it will not be referred to in code, you must give it a specific name.
False
If the intInventory variable contains the value 28, the condition If intInventory <= 25 Then will evaluate to ____.
False
If you are going to include color in an interface, limit the number of colors to four, not including white, black, and gray.
False
In a Do...Loop statement, the keyword While indicates that the loop instructions should be processed while the condition is false.
False
In a pretest loop, the evaluation of the condition occurs after the instructions within the loop are processed.
False
Like a Sub procedure header, a Function procedure header includes the As dataType section.
False
The Auto Hide button is located on the window's status bar.
False
The Double.TryParse and Decimal.TryParse methods can convert a string that contains a space.
False
The Not operator would make a True statement False, but would not make a False statement True.
False
The Properties window lists the names of the files included in the application you are creating.
False
The expression 2 * 3 + 1 > 1 * 2 + 3 Or 7 + 2 < 4 + 1 evaluates to False.
False
The first step in the planning phase of a programming solution is to sketch the user interface.
False
The repetition programming structure is used to make decisions in a program.
False
The text contained in a label control that identifies another control's contents should be meaningful and _______________ within the label.
False
The text contained in a label control that identifies other control's contents should be right-aligned within the label, according to Windows standards.
False
When an object is instantiated (created), each property must be assigned a value by the programmer.
False
When coding a selection instruction in Visual Basic, the code that follows the Else statement includes those instructions that will be executed when the condition is true.
False
You can determine whether a variable is being passed by value or by reference by looking at the Call statement.
False
You can include an identifying label on a group box by setting the group box's Identity property.
False
Visual Basic's ____ class contains many methods that your applications can use to perform financial calculations.
Financial
A label control used to display output should use which of the following BorderStyle settings?
FixedSingle
Case-Based Critical Thinking Questions Case 1 You have been hired to develop an application for Ridgeline Realty, a local real estate agency. The owner wants the application to display an image of the company logo and to say "Ridgeline Realty" in the title bar, and he doesn't want users to be able to change the size of the form. To prevent users of the application from changing the size of the form. you must set the FormBorderStyle property to ____.
FixedSingle
The label control property that specifies the color of the text inside a label is called the ________ property.
ForeColor
To align two or more selected controls along their left, right, top, or bottom borders, you would use the ____ menu.
Format
With the KeyPress event, use the e parameter's ____ property to cancel the key if it is an inappropriate one.
Handled
The first step in planning a Windows Form application is to ____.
Identify the application's purpose
Which of the following is the correct sequence of events when planning a windows form application?
Identify the application's purpose, identify the items that the user must provide, identify the items that the application must provide, determine how the user and the application will provide their respective items, draw a sketch of the user interface.
Case-Based Critical Thinking Questions Case 1: Jack of All Trades You've been asked to design an application for Jack of All Trades, which rents small power equipment to commercial and residential customers, to process its transactions. The strCustomer variable will be used to determine whether a customer is commercial (C) or residential (R). Commercial customers receive a 10% discount if they are members of the Rental Rewards Program. Residential customers receive a 5% discount if they are members. Which of the following If clauses would evaluate to True and apply the 10% discount for a commercial customer?
If strCustomer = "C" AndAlso strMember = "Y"
To prevent a text box from accepting inappropriate characters, you first use the e parameter's ____ property to determine the key that the user pressed.
KeyChar
A control's ____ event occurs each time the user presses a key while the control has the focus.
KeyPress
A text box's ____ event occurs each time the user presses a key while the text box has the focs.
KeyPress
Which of the following is not a commonly used property of a label control form?
LabelSize
You use a(n) ________ to display an image on a form.
ListBox
You use the ____ tool in the toolbox to add a list box to an interface.
ListBox
To keep you from inadvertently moving controls as you work in the IDE, click the form or control, then click the _________ option in the Format menu.
Lock Controls
When you want the application to end when the user clicks the Exit button, you write the following code: ____.
Me.Close()
Except for the ____ operator, all of the logical operators allow you to combine two or more conditions into one compound condition.
Not
The only controls that typically do not have access keys assigned to them in Windows applications are ___________.
OK and Cancel
Case-Based Critical Thinking Questions Case 1: PetPals You have been hired by PetPals Veterinary Clinic to modify an application. The application is used to enter and save all patient (pet) information obtained during an office visit. The account number for each pet must be available to be used by all procedures in the form. You should make sure the account number is declared using the ____ keyword.
Private
Which of the following is a valid header for a procedure that is passed the number 9.75?
Private Function CalcSubtotal(ByVal decPrice As Decimal) As Decimal
The character used to create an access key by inserting it into a text property is ____.
&
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 statements declares a class-level variable?
Private dblHeight As Double
You can tell whether a control has a TabIndex property by viewing its ____________ list.
Properties
In most cases, the last statement within a function is the ____ expression.
Return
Which of the following is a valid Return statement?
Return dblNumber
You can use either the SelectedItem or ____ property to determine whether an item is selected in a list box.
SelectedIndex
Each time either the user or a statement selects an item in a list box, the list box's SelectedValueChanged and ____ events occur.
SelectedIndexChanged
The number of choices the user can select from a list box is controlled by the list box's ____ property.
SelectionMode
In Windows applications, pressing the ____ and Tab keys simultaneously will move the focus backward.
Shift
To show or hide the access keys in your menu bar, press the ______ key(s) on your keyboard. To size a form using the keyboard, you can select the form and press and hold the ____ key(s), and then press one of the arrow keys on the keyboard.
Shift
To verify that a solution has been closed, you can look in the ____.
Solution Explorer
To sort the items in the list portion of a combo box, you use the combo box's ____ property.
Sorted
The position of the form on the screen when an application first starts is controlled by setting the ____ property.
StartPosition
You can stop an endless loop by clicking Debug on the menu bar, and then clicking ____.
Stop Debugging
The ____ property determines the order in which each control receives the focus.
TabIndex
A form's ____ property specifies the text that appears in the form's title bar.
Text
The ____ property of a control is used to specify the position of the text within the control.
TextAlign
A ____ provides an area in the form for the user to enter data.
TextBox
A control's ____ event occurs when a change is made to the contents of a control's Text property.
TextChanged
Case-Based Critical Thinking Questions Case 1: XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. The following code in a different program is not working properly. The message should display the value of the intCounter variable if the intCounter variable contains a balance that is less than or equal to 15. The message does not display. What mistake did the previous programmer make? intCounter = 1 Do Until intCounter <= 15 MessageBox.Show(intCounter) intCounter += 1 Loop
The While keyword should be used instead of the Until keyword.