This site is 100% ad supported. Please add an exception to adblock for this site.

# Visual Basic test 2

## Terms

undefined, object
copy deck
The If...Then...Else structure is called the ____ structure
Decision and selection
When the selection structure's condition evaluates to true, the set of instructions following the ____ is processed.
Then
The condition in a selection structure can contain ____.
variables and constants
properties
functions, mathematical operators, relational operators, and logical operators
The <> operator is an example of a ____ operator.
relational
Mathematical operators are evaluated ____ the relational operators.
before
Which of the following operators is evaluated first in an expression?
mathematical
All expressions containing a relational operator will result in ____.
either true or false answer only
In what order will the operators in the expression 7 - 3 < 9 + 8 / 2 * 2 be evaluated?
/, *, -, +, <
What is the result of 6 > 5 - 3 + 4 / 2 * 5?
false
Only one of the conditions connected by the ____ operator must be true for the compound condition to be true.
or
And, Not, and Or are examples of ____ operators.
logical
The ____ operator reverses the value of a condition.
Not
Which of the following represents the order of precedence for the logical operators?
Not, and, or
If the value of A is false and the value of B is true, then the value of A Or B is ____.
true
If the value of A is false and the value of B is true, then the value of A And B is ____.
false
If the value of A is false, the value of B is true, and the value of C is true, then the value of A Or B And C is ____.
true
If you use the ____ operator to combine two conditions, Visual Basic does not evaluate the second condition if the first condition is False.
and
Because only one of the conditions combined with the ____ operator needs to be True for the compound condition to be True, there is no need to evaluate the second condition if the first condition is True.
or
Expressions containing ____ operators always result in either a true or a false answer.
logical and relational
The ____ function returns the uppercase equivalent of the string.
UCase
The Select Case statement begins with the Select Case clause and ends with the word(s) ____.
End Select
To include more then one expression in a Case clause's expressionlist, simply separate each expression with a ____.
comma
The testexpression of the Select Case clause can contain ____.
variables and constants
functions
operators
Which of the following Case clauses could be used with the Select Case txtNum.Text clause?
Case "1"
Case "Two"
Which of the following can be used to specify a range of values in an expressionlist?
As, Is
Which of the following is a valid Case clause when using the keyword To?
Case 1 to 5
If a form has four check boxes, what is the maximum number of check boxes that can be selected at any one time?
four
Use a(n) ____ control in situations where you want to allow the user to select any number of choices from a group of one or more independent and nonexclusive choices.
check box
The minimum number of option buttons in an interface is ____.
2
Use the option button control in situations where you want to allow the user to ____.
select only one choice
If a form has four option buttons, how many option button(s) can be selected at any one time?
one
The label in an option buttonÂ’s caption property should be entered using ____ capitalization.
sentence
If you want more than one group of options buttons on a form, use a(n) ____ control.
frame
When an option button is selected, ____.
a black dot appears inside the button
You enter the Option Explicit statement in ____.
the form's General Declarations section
You use the ____ statement to invoke a user-defined sub procedure.
Call
You select a default option button by setting the option buttonÂ’s ____ to True.
Value
A local variable that retains its value when a procedure ends is called a(n) ____ variable.
static
Which of the following instructions is correct?
Static intCounter as Integer
When a dialog box is system modal, all applications are ____ until the user responds to the message.
suspended
When a dialog box is ____ modal, the user must respond to the message in the dialog box before he or she can continue working in the current application.
application
Which of the following will position the insertion point in the first position of a text box named txtItem?
txtItem.SelStart = 0
The ____ property tells Visual Basic how many characters to select in a text box.
SelLength
Which of the following will return the number of characters contained in the txtName text box?
Len(txtName.Text)
Assume that the insertion point is in the first position of a text box named txtItem. Which of the following will highlight all of the characters in the text box?
txtItem.SelLength = Len(txtItem.Text)
Programmers use the ____ structure to tell the computer to repeat one or more instructions contained in a program.
repetition
The three forms of the repetition structure are ____.
Do Until, Do While, For Next
Which of the following For instructions is valid?
For intNum = 1 to 4
For intNum = 1 to 5 Step 1
For intX = .5 to 1.25 Step .25
If you omit the stepvalue in a For...Next statement, Visual Basic uses a stepvalue of ____.
1 (a positive one)
The values for the For...Next statement's startvalue, stepvalue, and endvalue can be ____.
either integer or non-integer
either positive or negative
numeric
In the For Next loop, the ____ tells the loop where to begin, the endvalue tells the loop when to stop, and the ____ tells the loop how much to add to (or subtract from) the ____ each time the loop is processed.
startvalue, stepvalue, counter
Visual Basic uses the ____ variable in the For... Next statement to keep track of the number of times the loop instructions are processed.
counter
An objects Left property determines the object's ____.
distance from the left edge of the form
Which of the following is a posttest loop?
Do Until
The Do While loop evaluates the condition ____ processing any of the instructions within the loop.
before
In the ____ loop, the condition is not evaluated until after the loop instructions are processed the first time.
Do Until
What numbers will print on the form when the following code is processed?
intX = 1 Do While inX < 3 Print intX intX = intX + 1 Loop
1, 2
What numbers will print on the form when the following code is processed?
inX = 4 Do Print inX inX = inX - 1 Loop Until inX <= 2
4, 3
What numbers will print on the form when the following code is processed?
intX = 1 Do intX = intX + 1 Print intX Loop Until intX >= 2
2
____ means to assign a beginning value to a counter or accumulator.
Initializing
Assume that the user enters the sales amount in a Currency variable named curSales. Which of the following can be used to update the curTotalSales accumulator?
curTotalSales = curTotalSales + curSales
A(n) ____ is a group of controls of the same type that have the same name and share the same set of event procedures.
control array
The unique number that is assigned to each control in a control array is stored in each control's ____ property.
Index
The first control in an array named txtNum is referred to as ____.
txtNum(0)
The items inside the parentheses following the name of an event procedure are called ____.
arguments
If an application contains three command buttons and three label controls, the command buttons belong to the cmdCalc control array, and the label controls belong to the lblNum control array, then controls in both arrays are related by their position in t
parallel
The ____ property determines whether an object can respond to user-generated events.
Enabled
When you enter the number 3 in a text box that contains the number 5, the text box's ____ event occurs.
Change
You can use the ____ property to center the contents of a label control.
Alignment
The ____ function returns a value that indicates which dialog box button the user selected.
MsgBox
The ____ event, which occurs when a form is about to be removed from the screen, is triggered when you close the form using either the Close button or the Unload statement.
Unload
If you want to verify that the user wants to exit the application, you should place the appropriate code in the form's ____ event.
Unload
The data in a sequential access file can only be accessed ____.
randomly
sequentially
List boxes should contain a minimum of ____ selections.
3
You use Visual Basic's ____ method to specify the items you want displayed in a list box control.
AddItem
If you want a list box to display its values when the form first appears on the screen, you will need to define the list box items in the ____.
form's Load event procedure
Which of the following will add the word Idaho to a list box named lstState?
lstState.AddItem "Idaho"
Which of the following tells Visual Basic to select the second item in a list box named lstName?
lstName.ListIndex = 1
The first item in a list box has a ListIndex property value of ____.
0 (zero)
The information in a data file is organized into ____.
fields and records
A ____ is a single item of information about a person, place, or thing.
field
A ____ is a group of related items that contain all of the necessary data about a specific person, place, or thing.
record
The collection of information that an employer keeps on an employee is an example of a ____.
record
The three types of data files in Visual Basic are ____.
binary, sequential, random
Which of the following is true about sequential access files?
Sequential access files are similar to cassette tapes.
Each record in a sequential access file is both stored and retrieved in consecutive order.
Records in a sequential access file can be processed only in the order in which they are stored.
Opening a sequential access file for ____ allows you to add data to the end of an existing sequential access file.
Append
You open a sequential access file for ____ when you want to create a new sequential access file and then write data to it.
Output
You open a sequential access file for ____ when you want to read its contents.
Input
Which of the following will open the Payroll.dat file for reading as filenumber 1?
Open "a:\payroll.dat" For Input As #1
In the syntax of all three Open statement modes, the filenumber must be an integer between ____, inclusive.
1 and 511
Assume the Sales.dat file was opened as filenumber 1. Which of the following will write the contents of the intPerson and curSales variables to the Sales.dat file?
Write #1, intPerson, curSales
Which of the following will close only the file opened as filenumber 2?
Close #2
When you view a data file in a text editor, the string fields will be surrounded by ____.
quotation marks
Which of the following will stop the loop when there are no more records in the file opened as #1?
Do While Not EOF(1)
To allow a text box to accept and display more than one line of text, set the text box's ____ property to True.
MultiLine
To place a vertical scroll bar on a text box, set the text box's ____ property to 2-Vertical.
ScrollBars
____ keys allow the user to open a menu by using the Alt key in combination with a letter.
Access
If the txtCity text box contains the string, New York City, ____ will return York.
Mid(txtCity, 5, 4)
If the strEmpName variable contains the name Paul Drakson, the Right(strEmpName, 4) instruction is ____.
Mid(strEmpName, 9, 4)
The instruction Instr(1, Â“Have a good dayÂ”, Â“goodÂ”, 0) will return ____.
8

100