Exam 2- BIS 228

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

D. Structure statement

A VB programmer can combine multiple fields of related data using a _______. A. For Each statement B. DataType statement C. Public statement D. Structure statement

False

A function cannot have multiple arguments. (T/F)

A. An iteration

A single execution of a group of instructions inside a Do/Loop is called _______. A. An Iteration B. a loop C. a group D. a set

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. (T/F)

True

An array is a series of individual variables, all referenced by the same name but having unique indexes. (T/F)

C. an element

An array is a set of variables. Each individual variable is called _______ of the array. A. an index B. a collection variable C. an element D. a subscript

True

Boolean variables are commonly referred to as switches or flags. (T/F)

False

Code to create a user-defined Structure should be placed inside the procedure in which the structure will be used. (T/F)

A. display the predefined Windows dialog boxes for open, save, fonts, and colors

Common Dialog Boxes _______. A. display the predefined Windows dialog boxes for open, save, fonts, and colors B. allow Visual Basic programs to translate the text on the screen into another language C. can only be used on forms with menus D. allow you to create message boxes that will pop up and prompt the user for text input

A. a Dim Statement

Declare an array and specify the number of elements using _______. A. a Dim statement B. an Array statement C. the ListCount property D. the ListIndex property

A. Zero

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

True

For known number of iterations, the best option for a developer is to use a 'For/Next' loop. (T/F)

False

Forms removed from a project, by choosing "Exclude from project" from the "Project" menu, are permanently deleted. (T/F)

A. BusinessVendor(2).PhoneString

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).PhoneString B. Vendor(2).PhoneString C. BusinessVendor(2) D. PhoneString(2).Vendor

B. 26

How many elements are contained in the array created with the following code? Dim EmployeeString(25) As String A. 24 B. 26 C. 25 D. 0

False

If a list contains 15 items, the Count property will be 15 and the highest SelectedIndex property will be 16. (T/F)

D. B & C

If an exception is thrown and the message, "Index was outside the bounds of the array." displays, this indicates _______. A. 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. B & C

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. (T/F)

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. (T/F)

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. (T/F)

A. Close

If you need to have a form disappear and you want it removed from memory, you should use the _______ method. A. Close B. Hide C. ShowDialog D. Show

D. Context Menu

If you right-click an object, what type of menu pops up? A. Menu B. Control menu C. Submenu D. Context Menu

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. (T/F)

B. Activated

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. Startup B. Activated C. Active D. Load

A. Exit for

Immediately terminate interation in a For/Next loop with the _______ statement. A. Exit for B. Exit C. Continue D. Exit Loop

D. A&C

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. A & C

C. SchoolString

In the following statement, _______, refers to the array: For Each OneSchoolString In SchoolString A. OneSchoolString B. In C. SchoolString D. For Each

True

It is possible to create procedures that are not associated with click events. (T/F)

D. hold a list of values

List boxes and combo boxes _______. A. have a Text property during design time B. always have scroll bars C. are created with the same tool from the toolbox D. hold a list of values

False

List boxes and combo boxes have a Text property that can be accessed at design time. (T/F)

A. Private

Module-level variables declared as _______ are available only to the form in which they are declared. A. Private B. Friend C. Public D. OpenAccess

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. (T/F)

A. Resizing windows

Of the following choices, which CANNOT be done with common dialog boxes? A. Resizing windows B. Selecting colors C. Selecting fonts D. Opening files

C. The Next statement causes the <LoopIndex variable> to be incremented

Please select the response that is true for a For/Next Loop . A. It is used when the statements in a loop are executed for a specific number of iterations B. The Loop index keeps track of the number of iterations C. The Next statement causes the <LoopIndex variable> to be incremented D. All of the above

True

Project Properties specifies which form is the startup form, and which is the splash screen. (T/F)

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. (T/F)

True

The SelectedIndex property of a list box can be used as an array subscript to find the selected item in a list box. (T/F)

B. 0

The SelectedIndex property of the first item in a list is _______. A. -1 B. 0 C. 1 D. True

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. (T/F)

True

The Structure / End Structure statements may be used to represent a record of related fields of information. (T/F)

B. Assembly Information

The _______ is found in the Project Properties, and contains the information about the program title, program version, programmer, and company. A. about box B. assembly information C. splash screen D. startup form

D. polymorphism

The ability to define multiple subprograms or functions with the same name, but different signatures, in the same program is called _________. A. polynesia B. objectification C. polysignaturism D. polymorphism

C. ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex)

The code to delete the selected item from ColorListBox is _______. A. ColorListBox.RemoveItem B. ColorListBox.Clear C. ColorListBox.Items.RemoveAt (ColorListBox.SelectedIndex) D. ColorListBox.Delete (ColorListBox.ListIndex)

True

The code, "NameLabel.Text = NameComboBox.Text", or the code, "NameLabel.Text = NameComboBox.Items(NameComboBox.SelectedIndex)" will display the selected name in NameLabel. (T/F)

D. Both A&B

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. Both A&B

True

The default for passing arguments to function procedures and sub procedures is ByVal. (T/F)

False

The first form a project displays is called the default form. (T/F)

D. Startup Form

The first form the project displays is called the _________. A. AboutBox B. Default Form C. Main Form D. Startup Form

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 (T/F)

True

The following code is valid: Dim NameString() As String = {"Theresa", "Anita", "Julia"} (T/F)

False

The identifier for a loop index in a For/Next statement must be named LoopIndexInteger. (T/F)

A. Subscript

The individual variables in an array are accessed by their _______, which is their position in the array. A. subscript B. dimension C. ItemCount property D. ListCount property

B. Signature

The order and type of parameters that need to be passed to a subprogram or function procedure is known as the _______. A. Elements B. Signature C. Call stack D. Design

True

The return value from a function procedure is contained in a variable with the same name as the function. (T/F)

D. Load, Activated, Paint, Deactivate, FormClosing, FormClosed

The sequence of Form Events A. Activated, Deactivate, Load, FormClosed, FormClosing, Paint B. Deactivate, Activated, Paint, Load, FormClosing, FormClosed. C. Deactivate, Paint, Activated, Load, FormClosing, FormClosed D. Load, Activated, Paint, Deactivate, FormClosing, FormClosed

False

The size of a collection must be declared before it can be used. (T/F)

False

The statement Dim CityName(10) as String defines an array with 10 elements. (T/F)

True

There are several collections defined in .NET to help programmers manage in-memory data. (T/F)

False

To add scroll bars to list boxes and combo boxes you must set the ScrollAlwaysVisible property to True. (T/F)

B. Show Method

Use the _______ to display a form as modeless. A. ShowDialog method B. Show method C. Modeless method D. Mode method

True

Use the code: NamesListBox.SelectedIndex = -1, to deselect all items in a list. (T/F)

B. 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 is the effect of using the Static keywork to declare a variable? A. The variable is made read-only, and cannot be changed at run-time. B. The variable is only initialized once, and retaines its value when the procedure or block of code where it is declared is executed again. C. The variable cannot be accessed without receiving an electric shock. D. The variable is made available to all procedures and forms in the program.

A. 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 the key advantage of a .NET collection over an array? A. 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. B. A collection must have a declared size, by a Dim or ReDim statement, so you know the number of elements it contains, while an array does not have a declared size. C. A collection can have any desired order, while array elements must always be sorted in descending order. D. A collection can have elements of the type of a structure, while an array cannot have elements of structure type.

A. Sean

What is the value of NameString(1,1) after the following declaration is initialized? Dim NameString ( , ) As String = { "James", "Mary"},{ "Sammie", "Sean"} A. Sean B. Sammie C. James D. Mary

A. 25

What will be the value of ValueInteger after execution of these statements? For IndexInteger = 1 to 10 Step 2 ValueInteger += IndexInteger Next IndexInteger A. 25 B. 10 C. 20 D. 36

B. Modal

When a form is displayed as __________________, the user is prevented from accessing any other form, even if another form is visible. A. modeled B. modal C. modular D. modeless

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. (T/F)

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. (T/F)

False

When an array is initialized with the Dim Statement, the index starts at 1 instead of 0. (T/F)

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. (T/F)

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. (T/F)

B. When executing the For statement, the counter must be greater than the final value.

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 Next statement, the counter must be the same as the final value. D. When executing the For statement, the counter must be the same as the final value.

C. In the NEXT statement

When is the counter incremented in a FOR/NEXT statement? A. In the Exit For statement B. When the statements in the loop are executed C. In the NEXT statement D. In the FOR statement

A. For Each / Next statement

When you are working with an array, the easiest way to traverse the elements is to use the _______. A. For Each / Next statement B. Case structure C. If / Then statement D. Next statement

D. B & C

When you have data stored in a SortedList, you can access the elements using the A. Nickname B. Index C. Key D. B & C

False

When you use the Hide method on a particular form, the form will be removed from the screen and from memory. (T/F)

D. SelectAll

Which method is used to make all of the text in a text box appear selected? A. SelectText B. SelectedItem C. SelectedIndex D. SelectAll

A. TotalSalesDecimal(1) += SalesDecimal

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. TotalSalesDecimal(1) += SalesDecimal B. SalesDecimal += TotalSalesDecimal(2) C. TotalSalesDecimal(2) += SalesDecimal D. SalesDecimal += TotalSalesDecimal(1)

A. AnimalsListBox.Items.Add("monkey")

Which of the following instructions will add the word, monkey, to a list box named AnimalsListBox? A. AnimalsListBox.Items.Add("monkey") B. AnimalsListBox.Insert ("monkey") C. AnimalsListBox.Items.Add(monkey) D. AnimalsListBox.Insert(monkey)

B. Spell Check

Which of the following is NOT a type of common dialog box? A. Open File B. Spell Check C. Color D. Save File

B. It is shown in gray

Which of the following is NOT true about a menu item that has a check mark? A. It can be deselected by changing its Checked property to False. B. It is shown in gray. C. It is currently selected. D. It can be toggled on and off.

B. An argument that is passed ByRef cannot alter the original value.

Which of the following is NOT true about passing arguments to procedures or functions? A. Specifying ByVal or ByRef is not required when passing arguments. B. An argument that is passed ByRef cannot alter the original value. C. If ByVal or ByRef is not specified, the argument will be sent by value. D. Arguments may be passed ByVal or ByRef.

D. Menu items will not function at all if keyboard access is not assigned.

Which of the following is NOT true about using keyboard access with a menu item? A. The first menu's Text property should be &File. B. Do not use the same access key on a main menu name as you use on a form control. C. When the program is running, use the Alt key with the letter in the menu that is underlined, in order to access that procedure. D. Menu items will not function at all if keyboard access is not assigned.

C. Friend TotalBooksInteger As Integer

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. Private TotalBooksInteger As Integer B. Static TotalBooksInteger As Integer C. Friend TotalBooksInteger As Integer D. Dim TotalBooksInteger As Integer

C. EmployeeLabel.Font = FontDialog1.Font

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. FontDialog1.FontName = EmployeeLabel.FontName B. FontDialog1.Font = EmployeeLabel.Font C. EmployeeLabel.Font = FontDialog1.Font D. EmployeeLabel.Font FontDialog1.Font

D. The user can access a context menu on a button by right-clicking on the form.

Which of the following statements about context menus is NOT true? A. A program can have more than one context menu. B. A context menu can be assigned to a control by setting the control's ContextMenuStrip property. C. You can assign the same context menu to more than one control on the form. D. The user can access a context menu on a button by right-clicking on the form.

D. With multiple forms, the startup form must be named MainForm.

Which of the following statements about forms is NOT true? A. You can add an existing form from another project into your project. B. The number of forms in a project is virtually unlimited. C. You can have just one startup form in a project. D. With multiple forms, the startup form must be named MainForm.

B. Menu items are displayed in button controls at the top of the window.

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. Each item in a menu can have a keyboard access shortcut. D. In a menu, submenus will be indicated by a filled triangle to the right of the command.

B. A sub procedure returns a value to the point from which it was called.

Which of the following statements is NOT true? A. A function procedure returns a value to the point from which it was called. B. A sub procedure returns a value to the point from which it was called. C. A function procedure is a procedure that performs actions. D. A sub procedure is a procedure that performs actions.

C. Sub procedures and function procedures can return values to the point from which they were called.

Which of the following statements is NOT true? A. Function procedures and sub procedures can be supplied with arguments. B. Functions perform an action and then return a value to the point from which they were called. C. Sub procedures and function procedures can return values to the point from which they were called. D. Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef.

B. Variables declared as Private must be qualified (by adding the form name where they are declared) if they are used in any other form.

Which of the following statements is NOT true? A. Variables declared as Friend may be used in any procedure in any form in the project. B. Variables declared as Private must be qualified (by adding the form name where they are declared) if they are used in any other form. C. Module-level variables retain their values and are often used as counters and accumulators. D. Counters and accumulators declared with the Static statement may only be used within the procedure in which they are declared.

C. The scope of variables should be kept as narrow as possible; only give wider access by exception, if needed

Which of the following statements reflects good programming practice? A. All variables should be declared Friend, so they are available in all forms in the program B. All variables should be declared at the module level, so they are available to all subprograms and functions C. The scope of variables should be kept as narrow as possible; only give wider access by exception, if needed D. All variables should be declared Public, to allow other programs to update them

D. Text

Which property in a menu item's property window is used to change the words that will display in the menu? A. Name B. Index C. Visible D. Text

A. Checked

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? A. Checked B. Selected C. Enabled D. Visible

D. Enter Event

Which text box event occurs when a text box gets the focus? A. TextChanged event B. Click event C. Leave event D. Enter Event

True

Write code in the form's Activated event if you want to set the focus in a specific object when a form appears. (T/F)

A. Multidimensional Arrays

_______ can be used when two subscripts are needed to identify tabular data, such as when data is arranged in rows and columns. A. Multidimensional Arrays B. Complex subscripts C. List boxes D. Text boxes

A. Table lookup

__________ can be used to find a specific value in an array. A. A table lookup B. The Locate.Item property C. The Find method of an array D. A Case structure


Set pelajaran terkait

Section 7: Promulgated Addenda, Notices, and Other Forms in Texas

View Set

Ch 19 - Food Labels and Portion Sizes

View Set

Chapter 3- Subject Matter Jurisdiction and Diversity

View Set

Formulas and Names of Common Cations and Anions

View Set

Chapter 29: Chest Injuries, Chapter 30: Abdominal and Genitourinary Injuries

View Set