BIS 228 Final Exam Part 2
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 Arguments may be passed ByVal or ByRef. Specifying ByVal or ByRef is not required when passing arguments. If ByVal or ByRef is not specified, the argument will be sent by value.
Which of the following statements about menus is NOT true?
*Menu items are displayed in button controls at the top of the window. In a menu, submenus will be indicated by a filled triangle to the right of the command. Each item in a menu can have a keyboard access shortcut. Create a menu by adding a MenuStrip component to the form.
Which of the following statements is NOT true?
*Sub procedures and function procedures can return values to the point from which they were called. Functions perform an action and then return a value to the point from which they were called. Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef. Function procedures and sub procedures can be supplied with arguments.
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.
What is LINQ?
A general purpose query language for data
Which of the following statements is NOT true?
A sub procedure is a procedure that performs actions. A function procedure returns a value to the point from which it was called. Correct *A sub procedure returns a value to the point from which it was called. A function procedure is a procedure that performs actions.
__________ can be used to find a specific value in an array.
A table lookup
Visual Basic 2010 uses _______ database technology.
ADO.NET
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
What does ADO stand for?
ActiveX Data Objects
In order to add a template for a splash screen to a project, select _______ from the "Project" menu.
Add Windows Form Add Existing Item
Which of the following controls CANNOT be data bound?
All of the controls above can be data bound
An array is a set of variables. Each individual variable is called _______ of the array.
An element
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 key advantage to object-oriented programming and use of objects and classes is:
Code and data reusability
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
In the cookie analogy, a class is considered to be like a:
Cookie Cutter
Which of the following statements is NOT true?
Counters and accumulators declared with the Static statement may only be used within the procedure in which they are declared. Variables declared as Friend may be used in any procedure in any form in the project. Correct *Variables declared as Private must be qualified (by adding the form name where they are declared) if they are used in any other form. Module-level variables retain their values and are often used as counters and accumulators.
Which of the following windows can be used to add a new data source?
Data Sources
Which one of the following is NOT a component that appears in the component tray after a DataGridView control has been connected to a data source?
DataNavigator
When data read from a file has been changed by a program, but not yet written back to the file, what is it called?
Dirty
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 class can contain events, methods, and files.
False
A function cannot have multiple arguments.
False
After you connect a DataGridView control to a dataset, you must then write code in the form's Form_Load event in order to fill the dataset from the database table.
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 I set the Append parameter to True when I execute WriteAllText(), the target file will be overwritten.
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
It is usually good practice to fully expose the variables of a class to other classes by using the Public keyword, to make them easy to reference.
False
List boxes and combo boxes have a Text property that can be accessed at design time.
False
Output written to a File.IO stream will always go into the disk file, even if the program crashes before closing the file.
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 File.IO.Write() method places a NewLine (carriage return/line feed) character at the end of the written stream.
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 working with a dataset, you are connected to the original database and all changes take place in the original database table.
False
When you use the Hide method on a particular form, the form will be removed from the screen and from memory.
False
A library keeps track of all of the books in a database table. Author, Title, and Subject are _______ in the database table.
Fields
The _______ method is used to populate the data set.
Fill
What File.IO method is used to write the stream into the output file, without closing the file?
Flush()
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
If I need to check whether a file is open, how do I code this check in an If statement with the StreamWriter object?
If StreamWriter IsNot Nothing Then
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 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
What keyword is used, after the = sign, to instantiate an object from its class definition?
New
What common dialog can be used to have the user browse for a file to be opened?
OpenFileDialog
In a common 3-tier application model, what are the tiers?
Presentation, Business, Data
Module-level variables declared as _______ are available only to the form in which they are declared.
Private
Each row in a database table represents a _______.
Record
What is wrong with the following program?
RegisteredStudent is misspelled in the With statement
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?
SelectAll
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
The individual variables in an array are accessed by their _______, which is their position in the array.
Subscript
What database object handles retrieving and updating of data, by generating SQL (Structured Query Language) statements to access or update data?
Table adapter
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.
What will the StreamReader() instantiation statement do if the file to be read does not exist in the specified location?
Throws an exception
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 ReadOnly property only contains a Get method to return the current value of the property.
True
A StreamReader's .Peek() method returns -1 if the read is beyond the end of the input file.
True
A TableAdapter, a DataSet, and BindingSource objects are added to the component tray when you add data-bound controls to a Windows form.
True
A delimiter in a text file is a designated character, which is used to separate the text fields in each record.
True
A relational database generally contains multiple tables and relationships between the tables.
True
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
An object is a combination of code and data that can be treated as a single unit.
True
Boolean variables are commonly referred to as switches or flags
True
By default, a subclass inherits the properties and methods (but not the constructors) of its parent class.
True
For known number of iterations, the best option for a developer is to use a 'For/Next' loop.
True
If you select a database on a local disk drive when you select "Local Database File", the Data Source Configuration Wizard, if you so request, will create a copy of the database file in the project's folder.
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 navigation bar provides buttons for Add New, Delete, and Save, but these buttons will not produce permanent changes to the database itself unless you select the database file or the .xsd file in the Solution Explorer and set its "Copy to Output Directory" property to "Copy if newer".
True
The return value from a function procedure is contained in a variable with the same name as the function.
True
The schema describes the fields, data types, and any constraints of the database, such as required fields.
True
There are several collections defined in .NET to help programmers manage in-memory data.
True
Use the code: NamesListBox.SelectedIndex = -1, to deselect all items in a list.
True
Visual Basic 2010 uses ADO.NET database technology.
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
In a form with a DataGridView control, where is the smart tag in the picture below? (Little arrow looking thing)
Upper right corner
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?
You can have just one startup form in a project. You can add an existing form from another project into your project. Correct *With multiple forms, the startup form must be named MainForm. The number of forms in a project is virtually unlimited.
Do Until ItemIndexInteger = ItemsListBox.Items.Count - 1 Statements of the loop Loop
Zero
Declare an array and specify the number of elements using _______.
a Dim statement
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
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
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
The method that runs when an object is instantiated is called the:
constructor
Connecting a VB control to a field in a database is referred to as __________.
data binding
A _______ is a temporary set of data stored in the memory of the computer.
dataset
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 Get and Set methods of a property are usually where _______ is done.
validation checking