BIS 228 Exam 2
T
(T/F): 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.
F
(T/F): A function cannot have multiple arguments.
F
(T/F): A sub procedure returns a value to the point from which it was called.
F
(T/F): An argument that is passed ByRef cannot alter the original value.
F
(T/F): Code to create a user-defined Structure should be placed inside the procedure in which the structure will be used.
F
(T/F): Forms removed from a project, by choosing "Exclude from project" from the "Project" menu, are permanently deleted.
F
(T/F): If a list contains 15 items, the Count property will be 15 and the highest SelectedIndex property will be 16.
F
(T/F): If the programmer adds a Splash Screen template to a project, it will automatically be displayed for 10 seconds when the program begins loading.
F
(T/F): 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.
F
(T/F): 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.
T
(T/F): It is possible to create procedures that are not associated with click events.
F
(T/F): List boxes and combo boxes have a Text property that can be accessed at design time.
T
(T/F): More than one subprogram or function in a program can have the same name, as long as the signature of each one is unique.
T
(T/F): Project Properties specifies which form is the startup form, and which is the splash screen.
F
(T/F): Sub procedures and function procedures can return values to the point from which they were called.
F
(T/F): 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.
T
(T/F): The Next statement causes the <LoopIndex variable> to be incremented
T
(T/F): The SelectedIndex property of a list box can be used as an array subscript to find the selected item in a list box.
T
(T/F): 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.
T
(T/F): The code, "NameLabel.Text = NameComboBox.Text", or the code, "NameLabel.Text = NameComboBox.Items(NameComboBox.SelectedIndex)" will display the selected name in NameLabel.
T
(T/F): The default for passing arguments to function procedures and sub procedures is ByVal.
F
(T/F): The first form a project displays is called the default form.
T
(T/F): 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
T
(T/F): The following code is valid: Dim NameString() As String = {"Theresa", "Anita", "Julia"}
F
(T/F): The identifier for a loop index in a For/Next statement must be named LoopIndexInteger.
T
(T/F): The return value from a function procedure is contained in a variable with the same name as the function.
F
(T/F): The size of a collection must be declared before it can be used.
F
(T/F): The statement Dim CityName(10) as String defines an array with 10 elements
T
(T/F): There are several collections defined in .NET to help programmers manage in-memory data.
F
(T/F): To add scroll bars to list boxes and combo boxes you must set the ScrollAlwaysVisible property to True.
T
(T/F): Use the code: NamesListBox.SelectedIndex = -1, to deselect all items in a list.
F
(T/F): Variables declared as Private must be qualified (by adding the form name where they are declared) if they are used in any other form.
T
(T/F): 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.
T
(T/F): 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.
F
(T/F): When an array is initialized with the Dim Statement, the index starts at 1 instead of 0.
T
(T/F): 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.
T
(T/F): 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.
F
(T/F): When you use the Hide method on a particular form, the form will be removed from the screen and from memory.
F
(T/F): With multiple forms, the startup form must be named MainForm.
T
(T/F): Write code in the form's Activated event if you want to set the focus in a specific object when a form appears.
form event sequence
1. Load 2. Activated 3. Paint 4. Deactivate 5. FormClosing 6. FormClosed
.NET collection
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.
iteration
A single execution of a group of instructions inside a Do/Loop
Dim statement
Declare an array and specify the number of elements using _______.
a
Do Until ItemIndexInteger = ItemsListBox.Items.Count - 1 Statements of the loop Loop If there are 5 entries in ItemsListBox and ItemIndexInteger is set to 4 before the above Do-Loop is encountered, the statements in the loop will execute ______ times. a. Zero b.Four c. Five d. All of the above
element
Each individual variable is called _______ of the array
B
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 a. BusinessVendor(2) B.BusinessVendor(2).PhoneString c. Vendor(2).PhoneString d. PhoneString(2).Vendor
A
How many elements are contained in the array created with the following code? Dim EmployeeString(25) As String a. 26 b. 24 c. 0 (The code is incorrect to create an array.) d. 25
D
If an exception is thrown and the message, "Index was outside the bounds of the array." displays, this indicates _______. a. the array is completely full of data 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 d. The answer could be B or C
A
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. A. Activated B. Load C. Startup D. Active
D
In order to add a template for a splash screen to a project, select _______ from the "Project" menu. A. Add Windows Form B. Add Existing Item C. Add New Item D. Both answers A and C are correct
D
In the following statement, _______, refers to the array: For Each OneSchoolString In SchoolString a. In b. OneSchoolString c. For Each D. SchoolString
Private
Module-level variables that are available only to the form in which they are declared
A
Of the following choices, which CANNOT be done with common dialog boxes? A. Resizing windows B. Selecting fonts C. Selecting colors D. Opening files
0
The SelectedIndex property of the first item in a list
A
The code to delete the selected item from ColorListBox is _______. a. ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex) b. ColorListBox.Clear c. ColorListBox.RemoveItem d. ColorListBox.Delete (ColorListBox.ListIndex)
D
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 c. using the ComboBox.Add() method d. Answers A and B are correct.
signature
The order and type of parameters that need to be passed to a subprogram or function procedure
good programming
The scope of variables should be kept as narrow as possible; only give wider access by exception, if needed
C
What is the value of NameString(1,1) after the following declaration is initialized? Dim NameString ( , ) As String = { "James", "Mary"},{ "Sammie", "Sean"} a. James b. Mary C. Sean d. Sammie
D
What will be the value of ValueInteger after execution of these statements? For IndexInteger = 1 to 10 Step 2 ValueInteger += IndexInteger Next IndexInteger a. 10 b. 36 c.20 d. 25
B
When does a For/Next statement terminate iteration? a. When executing the Next statement, the counter must be greater than the final value. b. When executing the For statement, the counter must be greater than the final value. c. When executing the For statement, the counter must be the same as the final value. d. When executing the Next statement, the counter must be the same as the final value.
D
When you have data stored in a SortedList, you can access the elements using the a. Nickname b. Index c. Key D. B and C are correct.
D
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? a. SalesDecimal += TotalSalesDecimal(2) b. SalesDecimal += TotalSalesDecimal(1) c. TotalSalesDecimal(2) += SalesDecimal d. TotalSalesDecimal(1) += SalesDecimal
C
Which of the following instructions will add the word, monkey, to a list box named AnimalsListBox? a. AnimalsListBox.Insert ("monkey") b. AnimalsListBox.Items.Add(monkey) c. AnimalsListBox.Items.Add("monkey") d. AnimalsListBox.Insert(monkey)
D
Which of the following is NOT true about a menu item that has a check mark? A. It can be toggled on and off. B. It can be deselected by changing its Checked property to False. C.It is currently selected. D. It is shown in gray.
C
Which of the following is NOT true about using keyboard access with a menu item? A.When the program is running, use the Alt key with the letter in the menu that is underlined, in order to access that procedure. B. Do not use the same access key on a main menu name as you use on a form control. C. Menu items will not function at all if keyboard access is not assigned. D. The first menu's Text property should be &File.
C
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? A. Static TotalBooksInteger As Integer B. Dim TotalBooksInteger As Integer C. Friend TotalBooksInteger As Integer D. Private TotalBooksInteger As Integer
D
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? A. EmployeeLabel.Font FontDialog1.Font B. FontDialog1.Font = EmployeeLabel.Font C. FontDialog1.FontName = EmployeeLabel.FontName D. EmployeeLabel.Font = FontDialog1.Font
A
Which of the following statements about context menus is NOT true? A. The user can access a context menu on a button by right-clicking on the form. B. A context menu can be assigned to a control by setting the control's ContextMenuStrip property. C. A program can have more than one context menu. D. You can assign the same context menu to more than one control on the form.
B
Which of the following statements about menus is NOT true? A. Create a menu by adding a MenuStrip component to the form. B. Menu items are displayed in button controls at the top of the window. C. In a menu, submenus will be indicated by a filled triangle to the right of the command. D. Each item in a menu can have a keyboard access shortcut.
polymorphism
ability to define multiple subprograms or functions with the same name, but different signatures, in the same program
subscript
access individual variables in an array; their position in the array
Multidimensional arrays
can be used when two subscripts are needed to identify tabular data, such as when data is arranged in rows and columns
Static
causes the variable to only initialize once, and retain its value when the procedure or block of code (where it is declared) is executed again.
boolean variables
commonly referred to as switches or flags
common dialog boxes
display the predefined Windows dialog boxes for open, save, fonts, and colors
start-up form
first form the project displays
assembly information
found in the Project Properties, and contains the information about the program title, program version, programmer, and company
disabled
grayed out
close method
have a form disappear and you want it removed from memory
list/combo boxes
hold a list of values
exclude
kicking something out of the project without loosing it
SelectAll
method used to make all of the text in a text box appear selected
spell check
not a type of common dialog box
splash screen
only displays for the amount of time it takes the program to start up
context menu
pops up when you right click an object
modal
prevents the user from accessing any other form, even if another form is visible
text
property in a menu item's property window that is used to change the words that will display in the menu
checked
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 run
array
series of individual variables, all referenced by the same name but having unique indexes
Exit For
statement that Immediately terminate interation in a For/Next loop
Structure / End Structure
statements may be used to represent a record of related fields of information
Enter event
text box event that occurs when a text box gets the focus
NEXT statement
the counter incremented in a FOR/NEXT statement
For Each / Next statement
the easiest way to traverse the elements
For/Next loop
used for known number of iterations
Structure statement
used to combine multiple fields of related data
Show method
used to display a form as modeless
show dialog
used to display the form as modal
table lookup
used to find a match for a specific value (or string) by comparing it to each element in an array