MIS 315

The properties of a control are listed in the __________ window.

Properties

When you select a form control in design mode, ____________.

its sizing handles appear

If a Label control's AutoSize property equals False and the label is not wide enough for the text assigned to the control, ________.

the text will be only partially displayed

When Visual Studio displays a new project, a blank form is shown in the __________ window.

Designer

In order to delete a control from a form, you should select the control and then __________.

hit the Delete key on the keyboard

Which property is used to automatically adjust an image to fit the size of a PictureBox control?

SizeMode

A Visual Studio project may be saved in all of the following ways except _____________.

Click the Save Project button on the standard toolbar

Which of the following is NOT the way to end a Visual Basic application?

Click the down arrow on the Debug list box, and then click on Release

A Visual Basic project file is saved with this file extension.

.vbproj

A label control may be added to a form by a double-click on the Label control icon in the __________ window.

ToolBox

The code template for an event handler identifies it as a type of __________ procedure.

Sub

If the Visible property of a control is set to false, it __________ in the Designer window.

continues to be shown

You can display the Code window in all of the following ways except ____________.

Click Project on the menu bar, and then click Show all files

In the statement Me.Close(), the keyword Me refers to __________.

the current form

The __________ property can prevent the user from resizing, minimizing, or maximizing a window.

FormBorderStyle

To lock all of the controls on a form during design time ______________.

right-click an empty spot on the form, then select the Lock Controls option from the pop-up menu

A Label control's __________ property allows a label to change size to fit the text in its text property.

Autosize

Compile errors __________.

are errors such as misspelled key words or incorrect use of operators

You can run an application in all of the following ways except _____________.

Press the Ctrl-F4 keys

Intellisense ___________________________.

...

When you have an item selected and press the F1 key, you get __.

context-sensitive help

The code that is executed when the user clicks a button is known as __________.

an event handler

The value of a control's property may be changed while the application is running by __________.

using an assignment statement

The __________ property appears in parentheses so it will appear at the top of the alphabetical Property list.

Name

Which of the following is not a valid value for the FormBorderStyle property?

FixedDouble

Which of the following statements are correct?

A Visual Basic project must belong to a solution.

Assume you have a Button control named btnDisplayList. Which is the default name for an event procedure that will be executed when the user clicks on the control?

btnDisplayList_Click

Programs should use comments (remarks) to ____________________.

a. explain what the code does
b. save time when the program must be modified
c. save time when you have to debug the program
d. all of the above

Choose the correct assignment statement for a Label control named lblTitle that would align the control's text with the middle and center of the control's bounding box?

lblTitle.TextAlign = ContentAlignment.MiddleCenter

Which property determines the characters that appear in the title bar of Form1?

b. Form1.Text

What will the following section of code do?
Private Sub btnExit_Click(ByVal sender As System.Object, _
ByVal e as System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

c. Close the current form

Which of the following displays a message box with the text "Hello World"?

a. MessageBox.Show("Hello World")

The ___________ property of a label determines if the label can be seen by the user at runtime.

b. Visible

The color of the text in a Label control is determined by the __________ property.

c. ForeColor

The control is used to gather input the user has typed at the keyboard.

TextBox

The operator performs string concatenation.

ampersand (&)

You can break up a long statement into multiple lines as long as you don't break up a __________.

a. keyword
b. quoted string
c. variable name
d. all of the above

The _________________ control(s) can have the focus.

TextBox and Button

The order in which controls receive the focus is called the __________.

tab order

It's possible to view the order in which all controls on a form will receive the focus by __________.
a. clicking TabOrder in the Properties window

clicking View on the menu bar and then Tab Order

The statement to declare strName as a variable that can hold character data is _______________.

Dim strName As String

When you assign a value of one data type to a variable of another data type, Visual Basic attempts to perform _________ type conversion.

implicit

All numeric and date data types have a __________ method that returns a string representation of the contents of the variable.

ToString

What is the result after evaluating the following expression: 24 Mod 9

6

A keyboard access key is assigned to a button using the button control's __________ property.

Text

Which of the following statements will copy the contents of a TextBox named txtInput into a Label named lblDisplay?

lblDisplay.Text = txtInput.Text

In order to execute code before a form is displayed, place the code in the form's __________ event handler.

Load

The value returned by passing #12/31/10# to the CSng function is_________________

No value is returned. A runtime error is generated.

All of the following are advantages of using named constants except

they can be used in the place of keywords.

What will be assigned to the label when the following statements execute?
Dim dblVal As Double = 11.75
lblResult.Text = dblVal.ToString("n3")

11.750

You can perform all of the following actions with variables except:

Assign a variable's value to a constant

The contents of a text box may be cleared in Visual Basic code by __________.

by assigning the predefined constant String.Empty to the text property

What is the default value assigned to a new Date object?

12:00:00 AM, January 1 of the year 1

Which of the following declares an integer variable named intLength with an initial value of 12?

Dim intLength As Integer = 12

What default value is assigned to a Boolean variable?

False

Declaration statements ___________________.

give a name to variables or constants and specifies the type of data they will hold

Which of the following is not a valid Visual Basic data type?

Number

Which of the following is False in regard to naming variables?

Names may contain spaces.

Which of the following declares a variable named index that stores whole numbers? (Variable name prefixes have been intentionally been omitted.)

Dim index As Integer

Variables declared within a button's click-event are ____________ variables.

local

Which of the following has the highest order of precedence in arithmetic expressions?

Exponentiation

What will be the value of intAnswer after execution of these statements?
Const intNumA As Integer = 6
Const intNumB As Integer = 2
intAnswer = intNumA / intNumB + intNumA * intNumB

15

Which statement is true regarding the CInt function?

A floating-point number such as 24.7 is converted to 24, dropping its decimal positions.

Identify the error in the following code:
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
�ByVal e As System.EventArgs) Handles btnCalculate.Click
' Declare some variables
Dim sngNumber1 As Single
Dim sngNumber2 As Single
Dim sngSum As Sin

A conversion function such as CSng was not used.

When included in the Text property of a button, the && symbols placed side by side will display as a single & character.

True

When you declare a constant, you must assign it an initial value.

True

A form Load event takes place when the user first clicks on the form at run time.

False

A variable is a storage location on a computer's hard drive that holds information while the computer is off.

False

Which of the following declares a variable that can store the first name of a student?

Dim strFirstName as String

What is the value of intE after the following statements execute?
Dim intC As Integer
Dim intD As Integer
Dim intE As Integer
intC = 20
intD = 3
intE = intC \ intD

6

What is the value of dblOutcome after the following section of code executes?
Dim dblA as Double
Dim dblB as Double
Dim dblC as Double
Dim dblOutcome as Double
dblA = 45
dblB = 30
dblC = 3 * dblA / dblB
dblOutcome = 2 * (dblC + 15)

39

What is the purpose of using the following type of structure?
Try
Some statements
Catch
Other Statements
End Try

In order to catch run-time errors such as divide-by-zero and not have the program shut down

Which will be displayed in the label lblResult following execution of the code below?
Dim dblGrossPay as Double
dblGrossPay = 3500
lblResult.Text = dblGrossPay.ToString("c")

$3,500.00

A class-level variable ___________________.

a. is declared inside a class but outside any procedure
b. is accessible to all procedures in a class
c. is visible to all statements inside the class
d. all of the above

Which of the following code segments assigns the string "Great Year" to a label named lblMessage when the value in the variable sngSales is either greater than 50,000, or equal to 50,000?

If sngSales >= 50000 Then
lblMessage.Text = "Great Year"
End If

Suppose you want to determine whether a variable, sngPayAmount, is between 1200 and 1400, inclusively. If it is, you want to set lblMessage text to "Pay amount is in the range". Which of the following code segments will accomplish this?

If sngPayAmount >=1200 And sngPayAmount <=1400 then
lblMessage.Text = "Pay amount is in the range"
End If

Visual Basic uses values to represent characters such as A, B, and C in memory.

Unicode

Suppose you want to verify that the user has entered a value into a text box named txtBox. Which of the following code segments responds with an appropriate message if the user does not enter a value?

If txtBox.Text = String.Empty Then
MessageBox.Show("No data has been entered")
End If

To convert a copy of a String to all uppercase letters, use the method of the String object.

ToUpper

Which function accepts a String as its argument and returns True if the string contains only numeric digits?

IsNumeric

Which statement assigns the string strAddress to label lblAddress while removing only trailing spaces?

lblAddress.Text = strAddress.TrimEnd()

What value is assigned to the variable strSnip when the following statements execute?
Dim strSnip As String
Dim strFullString As String = "Washington"
strSnip = strFullString.Substring(1, 3)

ash

What value is assigned to the variable strSnip when the following statements execute?
Dim strSnip As String
Dim strFullString As String = "Washington"
strSnip = strFullString.Substring(7)

ton

What value will be assigned to intIndex when the following statements execute?
Dim strTarget As String = "asdsakfljfdgasldfjdl"
Dim intIndex as Integer = strTarget.IndexOf("GAS")

-1

What value will be assigned to intIndex when the following statements execute?
Dim strTarget As String = "asdsakfljfdgasldfjdl"
Dim intIndex = strTarget.IndexOf("as", 1)

12

What value will be assigned to intIndex when the following statements execute?
Dim strTarget As String = "asdsakfljfdgasldfjdl"
Dim intIndex = strTarget.IndexOf("as", 1, 10)

-1

The first character in a string has an index of .

0

Which of the following displays a message box to the user?

MessageBox.Show

The _____ keyword is required to use relational operators in a Case statement.

Is

Because only one radio button in a group can be selected at any given time, they are said to be

mutually exclusive

What value is assigned to sngTaxes by the following program segment, assuming that the user enters 50000 into the textbox txtSalary.Text?
Dim sngSalary, sngTaxes As Single
sngSalary = CSng(txtSalary.Text)
If (sngSalary > 50000) Then
sngTaxes = .40 * sngSa

15000

What value is assigned to sngTaxes by the following program segment, assuming that the user enters 30000 into the textbox txtSalary.Text?
Dim sngSalary, sngTaxes As Single
sngSalary = CSng(txtSalary.Text)
If (sngSalary > 50000) Then
sngTaxes = .40 * sngSa

3000

If the boolean expression A is True and B is False, the value of the logical expression A And B is __________.

False

If the boolean expression A is True and B is False, the value of the logical expression A Or B is __________.

True

What is assigned to lblMessage.Text when the following code segment executes?
Dim strName1 As String = "Jim"
Dim strName2 As String = "John"
If strName1 > strName2 Then
lblMessage.Text = "Jim is greater"
Else
lblMessage.Text = "John is greater"
End If

John is greater

What value is assigned to the String variable strSecond when the following code is executes?
Dim strFirst As String
Dim strSecond As String
strFirst = "1 2 Button My Shoe"
strSecond = strFirstName.ToUpper()

1 2 BUTTON MY SHOE

Which of the following statements will display a message box with the text "line 1" on one line, and the text "line 2" on another line?

MessageBox.Show("line 1" & ControlChars.Crlf & "line 2")

Identify the correct Select Case statement that checks the value of a variable intMyNum and assigns a value using the following guidelines:
value 1 or 7 or 15 add 100 to the variable
value 2 or 9 or 21 add 150 to the variable
value 3 or 6 or 13 add 200 to

Select Case intMyNum
Case 1, 7, 15
intMyNum += 100
Case 2, 9, 21
intMyNum += 150
Case 3, 6, 13
intMyNum += 200
Case else
txtOutput.Text = "Cannot find it"
End Case

Which change would correct the syntax error in the following code?
1: If intScore < 80 Then
2: strGrade = "C"
3: Else intScore > 80 Then
4: strGrade = "A"
5: End If

3: ElseIf intScore > 80 Then

What value will be assigned to strGrade when intScore equals 90?
If intScore > 60 Then
strGrade = "Passed"
End If
If intScore > 70 Then
strGrade = "Your mother still loves you"
End If
If intScore > 80 Then
strGrade = "Your parents would be Proud"
End If
I

Your parents would be Proud

Which statement tests the value of an expression once and then uses that value to determine the result?

Select Case ... Case Else

An If statement that appears inside another If statement is referred to as __________.

nested

Which is a correct way to call the method that displays a message box?

MessageBox.Show(Message, Caption, Buttons, Icon, DefaultButton)

The programmer cannot determine the content of a message box title bar.

False

The logical operators (And, Or, Xor, Not) combine two or more boolean expressions.

True

If the boolean expression on the left side of an OrElse operator is true, the boolean expression on the right side of the Or operator will not be evaluated.

True

Assuming that intAnswer equals 39, which of the given statements produces this MessageBox?

MessageBox.Show(intAnswer.ToString, "Result", _
MessageBoxButtons.OK, MessageBoxIcon.Information)

Which statement copies a string from a textbox named txtLastName, converts the string to upper case and saves the string in strLastName?

strLastName = txtLastName.Text.ToUpper()

The expression IsNumeric(13.75) returns the value __________.

True

Which of the following shows the correct way to remove leading and trailing spaces from a textbox named txtStudentID and assign the result to strStudentID?

Dim strStudentID as String
strStudentID = txtStudentID.Text.Trim()

What value will be assigned to dblCommission after the following code executes?
Dim dblMonthlySales, dblCommRate, dblCommission as Double
dblMonthlySales = 6500.00
Select Case dblMonthlySales
Case Is < 1000
dblCommRate = 0.05
Case 1000 to 9999.99
dblCommR

650.00

The expression Integer.TryParse("12.5", intNbr) performs the following:

Returns True and places the value 12.5 in the variable sngNbr

If a form contains two radio buttons (rad1 & rad2) and two check boxes (chk1 & chk2) and all four of these controls reside in the same group box, which of the following expressions can never be true?

rad1.Checked=True and rad2.Checked=True

Which of the following controls and methods provides a simple way to gather input from the user at runtime without placing a text box on a form?

InputBox

The entries in a ListBox are stored in the __________ property.

Items

To get the number of items stored in a ListBox, use the __________ property.

Items.Count

The first item in a ListBox has an index of __________.

0

Setting this property to True will put the items in a ListBox in alphabetical order.

Sorted

This method erases all the items in a ListBox.

Items.Clear

In the following statement that begins a For Next loop, what is the purpose of the Step clause?
For intX = 1 to 100 Step 5

It causes intX to be incremented by 5 each time the loop repeats.

What is the difference in the execution of the Do Until Loop (first example) and the Do Loop Until (second example)?
' First Example
sngPayAmount = 200
Do Until sngPayAmount > 150
sngPayAmount = sngPayAmount - 50
Loop
'Second Example
sngPayAmount = 200
Do

d. The first loop will never be executed while the second is an infinite loop.

What is wrong with the following code?
Dim intIndex As Integer
For intIndex = 5 To 1
ListBox.Items.Add(intIndex.ToString)
Next

You need to specify a negative step value in order to execute this loop.

All of the following are valid ComboBox style properties, except

List Combo Box

What value is assigned to lblSum.Text by the following code ?
Dim intTotal As Integer = 0
For intOuter = 1 To 3
For intInner = intOuter To 3
intTotal += intOuter * intInner
Next
Next
lblSum.Text = intTotal.ToString()

25

Which code example will calculate the number of checked items in a CheckedListBox named clbMovieNames and store the number in intCheckedMovies?

Dim intIndex As Integer
Dim intCheckedMovies As Integer = 0
For intIndex = 0 To clbMovieNames.Items.Count - 1
If clbMovieNames.GetItemChecked(intIndex) = True Then
intCheckedMovies += 1
End If
Next

Which of the following statements will assign a random number between 1 and 50 inclusive to intNum?

intNum = rand.Next(50) + 1

The __________ method can be used to place a new item at any position in a ListBox.

Items.Insert

Which property determines the amount of time, in milliseconds, that elapses between the user pointing the mouse at a control and the tool tip text's appearance?

InitialDelay

Which standard Visual Basic function returns the periodic payment amount for a loan?

Pmt

How can you cause scroll bars to appear in a ListBox at runtime?

A scroll bar is automatically added when a ListBox contains more items than can be displayed.

Which statement about the ListBox.Add method is true?

It will always place the item at the end of the list.

Which type of loop repeats as long as its loop condition remains True?

Do ... While

Suppose you would like your code to perform several tasks: Use a For loop with an InputBox to prompt the user four times for the price of four different T-shirts, then display each shirt price with a 25% discount in the ListBox lstResult. Which of the fol

Dim intIndex As Integer
Dim sngPrice, sngDiscountPrice As Single
For intIndex = 1 To 4
sngPrice = CSng(InputBox("Enter price of shirt " & intIndex.ToString))
sngDiscountPrice = sngPrice * 0.25
lstResult.Items.Add(intIndex & " " & sngDiscountPrice)
Next

A counter is a ____________ that can be incremented or decremented each time a loop runs.

integer variable

Which of the following code fragments calculates the average of 5 numbers input with an input box, and displays the result in lblResult?

intCount = 0
intSum = 0
Do While intCount < 5
intValue = CInt(InputBox("enter a number"))
intSum = += intValue
intCount += 1
Loop
sngAvg = intSum / intCount
lblResult.Text = sngAvg.ToString()

A ToolTip is a _____________ that allows the programmer to create a small popup message that displays when the user places the mouse over a control.

control

The SelectedItem property of a ListBox __________.

contains the text of the currently selected item

Which statement is True in regard to the following code?
intCount = 0
Do While intCount < 10
lstOutput.Items.Add("Good Job")
Loop

This is an infinite loop.

How many times will the message I love Visual Basic be displayed?
Dim intCount As Integer = 0
Do
lstOutPut.Items.Add("I love Visual Basic")
intCount += 1
Loop While intCount > 10

It will display once.

Which type of loop uses a pretest to initialize a counter variable and then increment the counter variable at the end of each iteration?

The For ... Next Loop

Which of the following statements correctly displays an input box?

strUserInput = InputBox("Enter your First Name", "Enter Name")

The __________ method adds a new entry as the last item in a ListBox.

Items.Add

Which of the following sections of code will calculate the monthly payment for a $150,000 house with a 30 year mortgage at an annual rate of 5.5%, and assign the result to dblMPay?

Dim dblAIntRate as Double = 5.5
Dim dblLoanAmt as Double = 150000
Dim intYears as Integer = 30
Dim dblMPay as Double
dblMPay = Pmt(dblAIntRate / 12, intYears * 12, -dblLoanAmt)

What is the difference in execution between the two following sections of code?
'Example 1
intCounter = 0
Do While intCounter < 10
lstOutput.Items.Add(intCounter * intCounter)
intCounter = intCounter + 1
Loop
'Example 2
For intCounter = 0 to 9
lstOutput.I

Both loops are executed in an identical manner.

A difference between a ListBox and a drop-down ComboBox is _________.

a ComboBox allows the user to enter text other than what is already in the List

What will be the final value of intCount?
Dim intCount As Integer = 3
Do
intCount += 6
Loop While intCount < 20

21

The InputBox function always returns a __________ value.

String

If lstMonths is a ListBox, which of the following will cause an exception to be thrown?

lstMonths.Items(lstMonths.Items.Count)

A procedure may not be accessed by procedures from another form if the __________ access specifier is used.

Private

If a procedure is called more than once in a program, the values stored in that procedure's local variables will persist only if declared with the __________ keyword.

Static

A is a special variable in a Sub or Function heading that receives an argument's value/address from a calling procedure.

parameter

Which of the following procedure calls to the GetANumber subprocedure is not valid?
Sub GetANumber(ByVal intNumber as Integer)
' (procedure body)
End Sub

GetANumber(intX + 3, intY)

When calling a procedure, passed arguments and declared parameters must agree in all of the following ways except __________.

the names of the arguments and parameters must correspond

(True/False) When debugging a program in break mode, the Step Into command causes the currently highlighted line of code to execute.

True

Which of the following code examples is a function that will accept three integer parameters, calculate their average, and return the result?

d. Function Average(ByVal intX As Integer, ByVal IntY as Integer, _
ByVal intZ As Integer) As Single
Return (intX + intY + intZ) / 3
End Function

What is incorrect about the following function?
Function sum(ByVal intX As Integer, ByVal intY As Integer) As Integer
Dim intAns As Integer
intAns = intX + intY
End Function

the function does not return a value

All of the following are true about functions except __________.

they can return one or more values

What is assigned to lblDisplay.Text when the following code executes?
Dim intNumber As Integer = 4
AddOne(intNumber, 6)
lblDisplay.Text = intNumber
' Code for AddOne
Public Sub AddOne(ByVal intFirst As Integer, ByVal intSecond As Integer)
intFirst += 1
in

4

What is the value of intTotal after the following code executes?
Dim intNumber1 As Integer = 2
Dim intNumber2 As Integer = 3
Dim intTotal As Integer
intTotal = AddSquares(intNumber1, intNumber2)
Function AddSquares(ByVal intFirst As Integer, ByVal intSeco

13

Which of the following does not apply to procedures and functions?

the execution time is significantly reduced by calling procedures and functions

Which statement is true in regard to passing an argument by value to a procedure?

A copy of the argument is passed to the procedure.

Which of the following procedures will keep track of the number of times it was called?

Private Sub KeepTrack()
Static intCount As Integer
intCount += 1
End Sub

Which of the following examples correctly uses an input box to assign a value to an integer, and returns the integer to the calling program using a reference parameter?

Sub GetInput(ByRef intNumber As Integer)
intNumber = CInt(InputBox("Enter an Integer"))
End Sub

Which of the following functions accepts a parameter named dblSales and returns the commission to the calling statement? Assume that the commission should equal the sales multiplied by the commission rate. Use the following table as a guide to the calcula

Function Calc(ByVal dblSales As Double) As Double
Dim dblRate As Double
Select Case dblSales
Case Is < 2000
dblRate = .1
Case Is >= 2000
dblRate = .15
End Select
Return dblRate * dblSales
End Function

Which debugging command executes a function call without stepping through function's statements?

Step Over

When a procedure finishes execution, __________.

control returns to the point where the procedure was called and continues with the next statement

In the context of Visual Basic procedures and functions, what is an argument?

A value passed to a procedure by the caller.

When a parameter is declared using the __________ qualifier, the procedure has access to the original argument variable and may make changes to its value.

ByRef

If you do not provide an access specifier for a procedure, it will be designated __________ by default.

Public

Choose a new, more descriptive name for the WhatIsIt function based on the result of the code below.
Function WhatIsIt(ByVal intRepeat as Integer) as Integer
Dim intResult as Integer = 1
Dim intCount as Integer
For intCount = 1 to intRepeat
intResult = in

PowersOfTwo

Which of the following can be returned by a function?

a. String values
b. Integer values
c. Boolean values
d. All of the above

What is the syntax error in the following procedure?
Sub DisplayValue(Dim intNumber As Integer)
MessageBox.Show(intNumber.ToString())
End Sub

Dim is not valid when declaring parameters

Which of the following declares a local variable that retains its value throughout every call to its procedure?

Static variableName As DataType

What is wrong with the following GetName procedure?
Sub GetName(ByVal strName As String)
strName = InputBox("Enter your Name:")
End Sub

The syntax for the call to InputBox is incorrect.

Which statement is not true regarding functions?

A function is a self contained set of statements that can receive input values.

Which of the following procedure declarations matches the call to the IsLetter procedure below?
Dim strText as String = txtInput.Text
Dim blnLetter as Boolean = IsLetter(strText)

Function IsLetter(ByVal strInput as String) as Boolean

What will be the value of dblSum after the button btnAdd is clicked, assuming that 25 is entered by the user into txtNum1, and 35 is entered into txtNum2?
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAd

a. 60

Which is the correct way to define a function named Square that receives an integer and returns an integer representing the square of the input value?

c. Function Square(ByVal intNum as Integer) As Double
Return intNum * intNum
End Function

When a project executes, its __________ is automatically displayed.

startup form

When creating a form in Visual Basic, code associated with that form is stored in a file with a _____ extension.

vb

An instance of a form is created using a __________ statement with the New keyword.

Dim

When a __________ form is displayed, no other form in the application can receive the focus until the form is closed.

Modal

A form's __________ event is triggered when the user switches to the form from another form or another application.

activated

Which of the following statements disables the mnuFilePrint object?

mnuFilePrint.Enabled = False

The ___________ event occurs when a form is in the process of closing, but before it has closed.

FormClosing

Standard modules are saved on disk as files that end with this extension.

vb

A module-level variable declared Public is also known as a __________ variable.

global

It's possible to prevent a form from closing by setting __________ in the FormClosing event.

e.Cancel = True

In order to add a menu to a form, you must place a __________ on the form

MenuStrip control

If the user should not be able to access an item that appears on a menu, set its _________ property to _______.

Enabled, False

How do you insert a separator bar into a menu?

Type a hyphen as a menu item object's Text property.

All of the following are true of the Show method of a form except:

the displayed form must be closed before you can access other forms

All of the following are true about the Hide method of a form except:

Using the Hide method removes the form from memory.

Which of the following is not true about the Form Activated event?

It's executed before the Load event procedure is processed.

A variable is accessible to statements outside the form if declared __________.

as Public and class-level

All of the following are true about standard modules except __________.

Standard modules may contain event handlers

What is the best way to share functions across more than one project?

b. Place the code for the functions in a module and add that module to each project.

Which of the following statements properly describe the Me keyword?

a. The Me keyword refers to the current instance of the form.

Which of the following is not true about a Form's class declaration?

It creates an instance of the form.

A context menu __________.

is shown when the user right clicks a form or control

Explain the nature of the reference to errorForm in the following code:
Dim errorForm As New frmError ( )
errorForm.lblProblem.Text = "Redmond, we have a problem

object variable

When a menu control's _________ property equals True, a check appears next to the menu item.

Checked

An event handler for a menu item is created by __________ in design view.

double-clicking the menu item

A menu item may be executed by a user in each of the following ways except __________.

by hovering the mouse over the item

What is the result of the following section of code?
Private Sub btnExit_Click(ByVal sender As System.Object, _
ByVal e as System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

c. Close the current form

Which of the following will display the getStudentDataForm form such that the programming statements that follow will not execute until the getStudentDataForm is closed?

getStudentDataForm.ShowDialog()

What property must be set on a menu item to have the user activate that option by hitting Ctrl+C?

ShortcutKeys

The best approach to move a menu item with an existing click event to a new location is:

click the menu item and drag it to the new location

The primary reason to use standard menu items, such as File, Edit, Help is ______.

most users expect to see these items

The last form created for a Windows Forms application is designated as the startup form.

False

Any form in a Windows Forms application can be designated as the startup form.

True

The best method to maintain consistency when renaming a form is to __________.

use Solution Explorer to change the form's file name

Choose the statement below that performs the comment found on line 2 of the following code segment.
Dim newStudentForm As New frmNewStudent()
'Initialize AcademicYear text box on NewStudent form to 1
newStudentForm.ShowDialog()

newStudentForm.txtAcademicYear.Text = "1

Values in an array are stored and worked with using a __________.

subscript

In the array declaration below, what is the significance of the number 7?
Dim strNames(7) As String

It's the upper bound (highest subscript value) of the array.

What is the error in the following code, and when will it be caught?
Dim intValues(5) As Integer
Dim intIndex As Integer
For intIndex = 0 To 10
intValues(intIndex) = 10
Next intIndex

c. An out of bounds error will occur. The error will occur at run time.

Which of the following statements sorts an array named intValues?

d. Array.Sort(intValues)

When changing the number of elements in an array at run-time with the ReDim statement, existing values in the array are destroyed unless the __________ keyword is used.

Preserve

The lowest possible subscript of an array is __________.

0

Assume that an integer array named intValues contains intNUM elements. Which of the following code segments most efficiently finds the largest element in the array and displays it in a text box named txtMax? Assume that values have already been inserted i

intMax = intValues(0)
For intIndex = 1 to intValues.length - 1
If intValues(intIndex) > intMax Then
intMax = intValues(intIndex)
End If
Next
txtMax.text = intMax.ToString

Which of the following code segments will copy the values of a 5 element array named intOldValues into another 5 element array named intNewValues?

intIndex = 0
Do While intIndex < 5
intNewValues(intIndex) = intOldValues(intIndex)
intIndex = intIndex + 1
Loop

Which of the following code segments is the correct solution for the following problem?
Find the first occurrence of the value "Joe" in the array strNames. Save the index of the element containing "Joe" in a variable named intPosition. Discontinue searchi

blnFound = False
intCount = 0
Do While (Not blnFound) And (intCount < strNames.Length)
If strNames(intCount) = "Joe" Then
blnFound = True
intPosition = intCount
End If
intCount += 1
Loop

Which of the following is the correct definition for a procedure that accepts a String array as an argument?

Sub ArrayParam(ByVal strStudents() As String)

Which of the following statements defines a two-dimensional Integer array named intTwoDArray with 6 rows and 4 columns?

Dim intTwoDArray(5, 3) As Integer

Which of the following could be used to iterate through each element of a two-dimensional array.

Nested loops For Next loops

Which statement is the best solution for the following problem?
Write a statement that initializes a two dimensional array of Integers named intGrades. The array will have 2 rows, with 93, 91, and 84 in the first row and 85, 89, and 91 in the second row.

Dim intGrades(,) As Integer = { {93, 91, 84}, {85, 89, 91} }

Which of the following allows an application to automatically execute code at regular time intervals?

Timer control

Which of the following provides the index of the highest numbered element of the array strNames?

a. strNames.Length - 1

This property of a control allows it be positioned a specified distance from the outside edge of the form.

anchor

Which of the following code segments displays each element in an Integer array named intValues without using an index to reference the items in the array.

For Each intNumber as Integer In intValues
MessageBox.Show(intNumber.ToString)
Next

Due to their similarities, it's easy to create a parallel relationship between an array and a __________.

ComboBox

What task is accomplished by the following code?
Dim intFirstArray(2) As Integer
Dim intSecondArray(2) As Integer
intFirstArray(0) = 10
intFirstArray(1) = 19
intFirstArray(2) = 26
intSecondArray = intFirstArray

intFirstArray and intSecondArray reference the same array in memory

What happens to most controls when the Enabled property is set to False?

The control appears grayed out, or dimmed

What value should be placed in a Timer control's Interval property to trigger a Tick event every 10 seconds?

10000

Which statement is not true about the following array?
Dim strFriends() As String = { "Rose", "Bud', "Flower", "Spring" }

The array has an unlimited number of elements.

Which type of loop is designed specifically to use a subscript to access the elements of an array?

For Next

Parallel arrays have all of the following characteristics, except __________.

They share a reference to the same array.

How many elements can be stored in the following array?
Dim sngGrades (2, 3) As Single

12

Procedures can be written to handle arrays and do all of the following, except __________.

a. store data in an array
b. sum or average the values
c. display the contents of the array
d. all of the above are correct

What is the best way to describe the following array?
Dim decCars (5, 10, 2) As Decimal

it contains 6 sets of 11 rows, each containing 3 columns.

The following statements apply to a Timer control, except _____________.

the smallest possible interval between tick events is a microsecond

Which of the following declares an array to contain the weekly sales of a group of salespeople for a year?
(use the constant intNumSalesmen for the number of salesmen and 52 for the number of weeks)

Dim decWeeklySalesTotal(intNumSalesmen - 1, 52 - 1) as Decimal

Which of the following code segments sets all elements of the array strStudentNames to the value NONE?

Dim intCount as Integer
For intCount = 0 to (strStudentNames.Length - 1)
strStudentNames(intCount) = "NONE"
Next intCount

What does the following section of code do?
Dim intCount as Integer
Dim intXXXX as Integer = intNumbers(0)
For intCount = 1 to (inNumbers.Length - 1)
If intNumbers(intCount) > intXXXX Then
intXXXX = intNumbers(intCount)
End If
Next intCount

Finds the Highest value in the array intNumbers

What does the following section of code do?
Dim intCount as Integer
Dim intXXXX as Integer = intNumbers(0)
For intCount = 1 to (inNumbers.Length - 1)
If intNumbers(intCount) < intXXXX Then
intXXXX = intNumbers(intCount)
End If
Next intCount

Finds the Lowest value in the array intNumbers

In order to retain data while a program is not running, data must be saved in __________.

a file

A file is like a stream of data that must be read from its beginning to its end.

sequential access

Which of the following code segments creates a new file named address.txt, writes the following two lines to the file, and then closes the file?
Bob Johnson
Somewhere USA

Dim addressFile As System.IO.StreamWriter
addressFile = System.IO.File.CreateText("address.txt")
addressFile.WriteLine("Bob Johnson")
addressFile.WriteLine("Somewhere USA")
addressFile.Close()

The method writes data to a file, followed by a newline character immediately after the data.

WriteLine

Which of the following code segments will read the following two lines from addressFile and place the data in two variables named strName, and strCity?
Bob Johnson
Somewhere USA

Dim addressFile As System.IO.StreamReader
addressFile = System.IO.File.OpenText("address.txt")
strName = addressFile.ReadLine()
strCity = addressFile.ReadLine()
addressFile.Close()

When opening a file, use this method to determine whether a file exists before you attempt to open it:

System.IO.File.Exists(filename)

The __________ is used to look ahead in a file and see if the current read position is at the end of the file.

Peek method

Visual Basic allows you to use a(n) statement to eliminate the need to prefix class names with their namespace names.

Imports

This control is used to display a standard Windows Open dialog box.

OpenFileDialog

The dialog controls which open or save files are displayed using the __________ method.

ShowDialog

When the PrintDocument control's Print method is executed, it triggers the __________ event.

PrintPage

Identify the following statements which will: Format a string to contain the word "Name" in a column of 20 characters wide, followed by the word "Address" in a second column, also 20 characters wide.

String.Format("{0, 20}{1, 20}", "Name", "Address")

To left justify the columns in the String.Format method, use preceding the column width.

a - sign

All of the following steps must be taken when a file is used by an application except ______.

the file must have a fully qualified path when opening the file.

Which of the following statements are not true about text files?

a text file cannot be viewed with an editor such as Notepad

The StreamWriter's CreateText method will _____________.

create a new file or replace an existing one

An application must first __________ a file before it can be used.

open

When a file is selected from an Open dialog box, the path and file name are stored in the control's __________ property?

Filename

The StreamReader.Read method will _______________________.

read the next character from a file

The following statements describe advantages of the Open and Save As dialog boxes except __________.

c. these dialog boxes show the user how to create and use files

This method is used to add more data to the end of an existing file.

System.IO.File.AppendText

This method places an item of data in a file without terminating the line.

Write

This predefined constant moves the print position forward to the next even multiple of 8 columns.

vbTab

This property allows the developer to specify the type of files that will appear in a dialog box.

Filter property

To change the color of text in a windows form, you could use this.

B. ColorDialog control
c. FontDialog control with the ShowColor property set to True
d. both b and c are correct

Which of the following writes a blank line to a sequential text file?

outputFile.WriteLine()

An Open dialog box displays the current folder unless the __________ property specifies a different path

c. InitialDirectory

What does the following line do?
Do Until inputFile.Peek = -1

d. Checks to see if all the data in the file has been read

Which of the following code segments writes the contents of three parallel arrays named strStudentName, intID, and strMajor to a file in the format below? Assume all arrays have the same number of elements.
Vince Student, 1234, Computer Science
Nancy Stud

a. For intCount = 0 to strStudentName.Length - 1
outputFile.Write(strStudentName(intCount)
outputFile.Write(", ")
outputFile.Write(intID(intCount))
outputFile.Write(", ")
outputFile.WriteLine(strMajor(intCount))
Next intCount

A structure should be used instead of an array when __________.

b. related items are of different data types

The fields within a structure can be __________.

a. String data types
b. Integer data types
c. an array of Double data types
d. all of the above

Which of the following declares a structure data type named Complex, which has two fields named Real and Imaginary, both of which are of type Double?

b. Structure Complex
Dim Real as Double
Dim Imaginary as Double
End Structure

Reports with columnar data should not use __________.

a. proportionally spaced fonts

The color of text printed by an e.Graphics.DrawString statement is determined by the __________ argument

c. Brushes

The FontDialog control allows the user to determine the __________.

a. Font
b. Font Style
c. Font Size
d. all of the above

A database _____________is organized into rows and columns.

table

A is a column (or columns) that uniquely identifies each row of data in a database.

primary key

The SelectedValue property of a data-bound ListBox returns the value in the column specified by the ________ property.

ValueMember

A ________ component passes data from one or more database tables to your program.

TableAdapter

A ________ is an in-memory copy of data read from database tables.

dataset

A ________ statement in SQL retrieves data from a database.

Select

A table adapter's _________ method is used to add a new row to a table.

Insert

In an SQL query, the _____ wildcard character, used with the LIKE operator, will match multiple unknown characters.

%

Which statement does NOT accurately describe a database row?

When discussing a table, we refer to the rows by name.

Which table adapter method reads data from the database into the dataset?

Fill

You use to provide multiple selection conditions in an SQL statement.

compound expressions

A _________ keeps track of a database name, location, and authentication information.

Connection object

What is the simplest way to update a user's changes to the database?

Use the Update method of a table adapter

The following statements are true about a data source except

Data can be retrieved from but not written back to a data source.

Each database ________ is also known as as a row in a database table.

record

A _______________ is the design of tables, columns and relationships between tables for the database.

database schema

__________ allows individual controls such as text boxes and labels to be linked to and automatically display the contents

Data binding

The SQL Select statement retrieves data from a database and returns it in a __________, a set of records matching the selection criteria.

Dataset

All of the following are true about SQL except __________.

SQL stands for "Sequenced Query Language

Assume the following table named Student exists in a database:
Name Number Address GPA CumHrs
Adams, Carol 123 Redford Hall 3.6 67
Baker, Paul 345 Kingman Hall 2.1 34
Jones, Jill 456 Bassett Hall 3.2 89
Smith, Mary 887 Redford Hall 3.8 112
Taylor, Darren

SELECT Name, GPA FROM Student WHERE GPA >=3.5

__________ is a tool provided by Visual Studio for creating and modifying SQL queries.

Query Builder

The Where clause of an SQL statement specifies __________.

specifies which rows should be retrieved

The __________ control displays information from a dataset in row and column format.

DataGridView

Which item describes the function of the following SQL statement?
SELECT ID, Last_Name, First_Name, Address
FROM Members
WHERE Last_Name = @LastName

a parameterized query

In SQL the bit type is equivalent to which Visual Basic data type?

Boolean

A unique student ID number could be used as a _________, whereas a student's last name would not be suitable because two students might have the last name.

Primary Key

A complete set of data for a single student that includes the following information is called a __________.
Student ID, First Name, Last Name, Major, Class

Row

Which of the following statements is false?

Visual Basic statements can directly access database fields without using the DBMS.

The correct SQL syntax to sort a table by Last_Name in order of A-Z is ______.

ORDER BY Last_Name ASC

Which of the following SQL WHERE clauses will select all students whose last name begins with "S"?

Where LastName Like "S%

This was the first server-side web programming technology introduced by Microsoft.

ASP

ASP.NET is called a _____________ because it provides development tools, code libraries, and visual controls for web based applications.

platform

Which of the following is not one of the four types of web sites available from the ASP.NET Open WebSite dialog box?

HTML

When an ASP.NET application is created, it contains only one file named __________.

Web.config

The following controls all have a Windows form counterpart except __________.

RadioButtonList

The following are true about a HyperLink control, except __________.

it generates an event

Which statement is true about the CheckBoxList control?

a. each item has a Selected property
b. only one item can be checked at a time
c. it functions just like a ListBox control
d. A and C are correct

Which Web control is similar to the Windows form ComboBox control?

DropDownList

All of the following are true about HTML tables except ________.

they are more powerful than ASP.NET controls

Which method allows the user to navigate to another Web page?

Response.Redirect

Web forms use a ____________ control to access a database and retrieve table rows.

DataSource

The GridView control provides all the following features except __________.

it's designed to display single row at a time is displayed

The DetailsView control allows the user to do which of the following?

b. connect to a data source

Internet Information Services (IIS) __________.

implements a professional-quality Web server

Which of the following is not a Web browser?

Windows Explorer

What does a Web browser do for an end user?

a. Interprets HTML
b. Connects to Web sites

Which of the following outlines the proper order for connecting a web form to a database?

Copy the database file to the App_Data folder
Add a GridView control to the form
Select the Data Source type
Configure the SELECT statement for the database query

Which is not a valid URL protocol?

htm://

ASP.NET controls are more powerful than HTML controls because __________.

they use event handlers to carry out actions at runtime

When designing web forms, the Toolbox window contains all of the following groups of controls except:

Ftp controls for connecting to remote computers.

Which of the following is not a TextBox TextMode property choice?

Sorted

Which of the following is true regarding ASP.NET?

ASP.NET provides many controls that are similar to those used in Windows forms.

Which of the following is true about the HTML Designer?

b. it's a tool that simplifies the design of Web pages and Web forms

When running a web application with Visual Studio or Visual Web Developer, _________________.

a. the resulting Web page is displayed in a Web browser
b. the server executes statements in the code-behind file
c. the server creates a Web page consisting of standard HTML tags and controls
d. all of the above

Web applications use the __________ control instead of the datasets used by desktop applications.

Datasource

Which of the following is not true about the ASP.NET development platform?

Visual Basic is the only programming language that may be used.

Web applications are designed around a __________ model, meaning the one computer produces data while another uses data.

Client-Server

All of the following are browsers your Web pages should be tested with except __________.

WebPro

A web form can be identified by its __________ filename extension.

.aspx

A postback occurs when the server processes the page contents and __________.

resends a modified version of the same page currently displayed

When the Web form default.aspx is added to a project, another file named __________ is also created.

default.aspx.vb

Web applications use a __________ control which is similar to the DataGridView used by desktop applications.

GridView