BIS228 Ch 5 quiz
The SelectedIndex property of the first item in a list is _______.
0
What will be the value of ValueInteger after execution of these statements? For IndexInteger = 1 to 10 Step 2 ValueInteger += IndexInteger Next IndexInteger
25
How many elements are contained in the array created with the following code? Dim EmployeeString(25) As String
26
What is the key advantage of a .NET collection over an array?
A collection can be added to, deleted from, and cleared at run time, without declaring the maximum size of the collection, while an array must have a maximum size declared by a Dim or ReDim statement.
Which of the following statements is NOT true?
A sub procedure returns a value to the point from which it was called.
__________ can be used to find a specific value in an array.
A table lookup
If you want to make sure that the focus is in the correct object when a form displays, you should write code in the form's _______ event.
Activated
In order to add a template for a splash screen to a project, select _______ from the "Project" menu.
Add Windows Form Add New Item Both A and C
Which of the following is NOT true about passing arguments to procedures or functions?
An argument that is passed ByRef cannot alter the original value.
Which of the following instructions will add the word, monkey, to a list box named AnimalsListBox?
AnimalsListBox.Items.Add("monkey")
Given the following code, which of the choices below would be used to access the phone number of the 3rd vendor? Private Structure Vendor Dim VendorIDString As String Dim NameString As String Dim PhoneString As String End Structure Dim BusinessVendor(5) As Vendor
BusinessVendor(2).PhoneString
Which property of a menu must be set to True if you want an item to have a check mark next to it when the project runs?
Checked
If you need to have a form disappear and you want it removed from memory, you should use the _______ method.
Close
The code to delete the selected item from ColorListBox is _______.
ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex)
If you right-click an object, what type of menu pops up?
Context menu
Declare an array and specify the number of elements using _______.
Dim statement
Which of the following is the correct way to assign a font to a label using common dialog boxes after the statement FontDialog1.ShowDialog() has been executed?
EmployeeLabel.Font = FontDialog1.Font
Which text box event occurs when a text box gets the focus?
Enter event
Immediately terminate interation in a For/Next loop with the _______ statement.
Exit For
A function cannot have multiple arguments.
False
Code to create a user-defined Structure should be placed inside the procedure in which the structure will be used.
False
Forms removed from a project, by choosing "Exclude from project" from the "Project" menu, are permanently deleted.
False
If a list contains 15 items, the Count property will be 15 and the highest SelectedIndex property will be 16.
False
If the programmer adds a Splash Screen template to a project, it will automatically be displayed for 10 seconds when the program begins loading.
False
If you click on an item in a menu that is grayed out, you will toggle it on, and it will appear in black text.
False
If you decide to use the 'Remove' method for an object, you will have to specify the index value as the parameter for the method.
False
List boxes and combo boxes have a Text property that can be accessed at design time.
False
The Alphabetize property can be set to True and the combo or list box will automatically be sorted when an item is added to the list.
False
The first form a project displays is called the default form.
False
The identifier for a loop index in a For/Next statement must be named LoopIndexInteger.
False
The size of a collection must be declared before it can be used.
False
The statement Dim CityName(10) as String defines an array with 10 elements.
False
To add scroll bars to list boxes and combo boxes you must set the ScrollAlwaysVisible property to True.
False
When an array is initialized with the Dim Statement, the index starts at 1 instead of 0.
False
When you use the Hide method on a particular form, the form will be removed from the screen and from memory.
False
When you are working with an array, the easiest way to traverse the elements is to use the _______.
For Each / Next statement
Which of the following is the correct statement to declare a module-level variable that will keep track of the number of books sold at a school bookstore, and that will be available in order to display the total on a separate summary form?
Friend TotalBooksInteger As Integer
When is the counter incremented in a FOR/NEXT statement?
In the NEXT statement
Which of the following is NOT true about a menu item that has a check mark?
It is shown in gray.
The sequence of Form Events
Load, Activated, Paint, Deactivate, FormClosing, FormClosed
Which of the following statements about menus is NOT true?
Menu items are displayed in button controls at the top of the window.
Which of the following is NOT true about using keyboard access with a menu item?
Menu items will not function at all if keyboard access is not assigned.
_______ can be used when two subscripts are needed to identify tabular data, such as when data is arranged in rows and columns.
Multidimensional arrays
Module-level variables declared as _______ are available only to the form in which they are declared.
Private
Of the following choices, which CANNOT be done with common dialog boxes?
Resizing windows
In the following statement, _______, refers to the array: For Each OneSchoolString In SchoolString
SchoolString
What is the value of NameString(1,1) after the following declaration is initialized? Dim NameString ( , ) As String = { "James", "Mary"},{ "Sammie", "Sean"}
Sean
Which method is used to make all of the text in a text box appear selected?
SelectedAll
Use the _______ to display a form as modeless.
Show method
The order and type of parameters that need to be passed to a subprogram or function procedure is known as the _______.
Signature
Which of the following is not a type of common dialog box?
Spell check
The first form the project displays is called the _________.
Startup Form
A VB programmer can combine multiple fields of related data using a _______.
Structure statement
Which of the following statements is NOT true?
Sub procedures and function procedures can return values to the point from which they were called.
Which property in a menu item's property window is used to change the words that will display in the menu?
Text
Please select the response that is true for a For/Next Loop .
The Next statement causes the <LoopIndex variable> to be incremented
Which of the following statements reflects good programming practice?
The scope of variables should be kept as narrow as possible; only give wider access by exception, if needed
Which of the following statements about context menus is NOT true?
The user can access a context menu on a button by right-clicking on the form.
What is the effect of using the Static keywork to declare a variable?
The variable is only initialized once, and retaines its value when the procedure or block of code where it is declared is executed again.
Which of the following code samples is valid for accumulating the total sales for the Tigers baseball club if the Tigers are the second group in the list?
TotalSalesDecimal(1) += SalesDecimal
A table lookup is used to find a match for a specific value (or string) by comparing it to each element in an array.
True
An array is a series of individual variables, all referenced by the same name but having unique indexes.
True
Boolean variables are commonly referred to as switches or flags.
True
For known number of iterations, the best option for a developer is to use a 'For/Next' loop.
True
If you want the user to be able to use the dialog boxes from the Windows environment so he can save files and change colors, you will need to add two common dialog components to your form, the SaveFileDialog for saving files, and the ColorDialog for changing colors.
True
It is possible to create procedures that are not associated with click events.
True
More than one subprogram or function in a program can have the same name, as long as the signature of each one is unique.
True
Project Properties specifies which form is the startup form, and which is the splash screen.
True
The SelectedIndex property of a list box can be used as an array subscript to find the selected item in a list box.
True
The ShowDialog method displays a form as modal and is a good choice when you need the user to respond to the form before continuing.
True
The Structure / End Structure statements may be used to represent a record of related fields of information.
True
The code, "NameLabel.Text = NameComboBox.Text", or the code, "NameLabel.Text = NameComboBox.Items(NameComboBox.SelectedIndex)" will display the selected name in NameLabel.
True
The default for passing arguments to function procedures and sub procedures is ByVal.
True
The following code is valid for creating a structure named Student: Structure Student Dim StudentIDString As String Dim FirstNameString As String Dim LastNameString As String Dim GPADecimal As Decimal End Structure
True
The following code is valid: Dim NameString() As String = {"Theresa", "Anita", "Julia"}
True
The return value from a function procedure is contained in a variable with the same name as the function.
True
There are several collections defined in .NET to help programmers manage in-memory data.
True
When adding a form from another project, you should copy the form's files into the project folder and then select "Add Existing Item" from the "Project" menu.
True
When an argument is sent ByVal, a copy of the argument's value is sent to the procedure so that the procedure cannot alter the original value.
True
When copying form files from another project, only copy the file with the .vb file extension and VB will automatically copy the form files with the Designer.vb extension and the .resx extension.
True
When creating menus with the MenuStrip component, the system creates a unique 'Name' property and you only change the 'Text' property that appears on the menu-bar.
True
Write code in the form's Activated event if you want to set the focus in a specific object when a form appears.
True
se the code: NamesListBox.SelectedIndex = -1, to deselect all items in a list.
True
Which of the following statements is NOT true?
Variables declared as Private must be qualified (by adding the form name where they are declared) if they are used in any other form.
When does a For/Next statement terminate iteration?
When executing the For statement, the counter must be greater than the final value.
Which of the following statements about forms is NOT true?
With multiple forms, the startup form must be named MainForm.
Do Until ItemIndexInteger = ItemsListBox.Items.Count - 1 Statements of the loop Loop
Zero
The data that appears in a combo box when it is first displayed can be added to the combo box _______.
a. using the Form_Load procedure and the combo box Items.Add method b. during design time in the Items Collection of the combo box
An array is a set of variables. Each individual variable is called _______ of the array.
an element
A single execution of a group of instructions inside a Do/Loop is called _______.
an iteration
The _______ is found in the Project Properties, and contains the information about the program title, program version, programmer, and company.
assembly information
When you have data stored in a SortedList, you can access the elements using the
b. Index c. Key Correctd. B and C are correct.
If an exception is thrown and the message, "Index was outside the bounds of the array." displays, this indicates _______.
b. the subscript is a value greater than the upper subscript declared in the Dim statement for the array c. the subscript value is less than zero
Common Dialog Boxes _______.
display the predefined Windows dialog boxes for open, save, fonts, and colors
List boxes and combo boxes _______.
hold a list of values
When a form is displayed as __________________, the user is prevented from accessing any other form, even if another form is visible.
modal
The ability to define multiple subprograms or functions with the same name, but different signatures, in the same program is called _________.
polymorphism
The individual variables in an array are accessed by their _______, which is their position in the array.
subscript