CSS 331 - Visual Basic - Test 2 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

If the strDue variable contains the string "$8.50$", what will the strDue.Trim("$"c) method return?

"8.50"

If the strDue variable contains the string "$8.50$", what will the strDue.TrimStart("$"c) method return?

"8.50$"

The concatenation operator in Visual Basic

&

What will the following code display in the lblAsterisks control? For intX as Integer = 1 to 2 For intY As Integer = 1 to 3 lblAsterisks.Text = lblAsterisks.Text & "*" Next intY lblAsterisks.Text = lblAsterisks.Text & ControlChars.NewLine Next intX a. *** *** b. *** *** *** c. ** ** ** d. *** *** *** ***

*** ***

If the strAddress variable contains the string "15 Palm Ave.", what will the strAddress.IndexOf("Palm", 5) method return? a. -1 b. 5 c. 6 d. False

-1

What does the IndexOf method return when the string does not contain the subString?

-1

What does the Peek method return when the end of the file is reached? a. -1 b. 0 c. the last character in the file d. the newline character

-1

Write the Financial.Pmt method that calculates the monthly payment (expressed as a positive number) for a loan of $130,000 for 30 years with a 2% annual interest rate.

-Financial.Pmt(0.02 / 12, 30 * 12, 130000)

Which of the following calculates the monthly payment (expressed as a positive number) for a loan of $10,000 for 2 years with a 3.5% annual interest rate? a. -Financial.Pmt(0.035, 2, 10000) b. -Financial.Pmt(0.035 / 12, 2 * 12, 10000) c. -Financial.Pmt(2 * 12, 0.035 / 12, 10000) d. -Financial.Pmt(10000, 0.035 / 12, 2 * 12)

-Financial.Pmt(0.035 / 12, 2 * 12, 10000)

Write the Financial.Pmt method that calculates the monthly payment (expressed as a positive number) for a loan of $25,000 for 10 years with a 4% annual interest rate.

-Financial.Pmt(0.04 / 12, 10 * 12, 25000)

The name of a class file ends with which of the following filename extensions? a. .cla b. .cls c. .vb d. None of the above

.vb

(Read code carefully, answer with an integer) How many times will the string literal "Hi" appear in the lblMsg control? Dim intCount As Integer Do While intCount > 4 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine intCount += 1 Loop

0

(Read code carefully, answer with an integer) How many times will the string literal "Hi" appear in the lblMsg control? Dim intCount As Integer Do lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine intCount += 1 Loop While intCount > 4

1

If a list box's Sorted property is set to True, how will the numbers 4, 35, 3, 1, and 12 be displayed in the list box? a. 4, 35, 3, 1, 12 b. 1, 3, 4, 12, 35 c. 1, 12, 3, 35, 4 d. 35, 12, 4, 3, 1

1, 12, 3, 35, 4

If the loop's For clause is For intX = 2 to 8 Step 2, what value will be in the intX variable when the loop ends?

10

For intX as Integer = 10 To 99, the loop will end when the intX variable contains the number _____? a. 100 b. 111 c. 101 d. 110

100

(Read code carefully, answer with an integer) When the computer stops process the loop, the variable intCount contains what number? For intCount As Integer = 6 To 13 Step 2 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine Next intCount

14

If the strAddress variable contains the string "41 Main Street", what will the strAddress.IndexOf("Main") method return? a. -1 b. 3 c. 4 d. True

3

When a list box's Sorted property is set to True, in what order will the following items appear: 35, 40, 3, 4?

3, 35, 4, 40

What will the following code display in the lblSum control? Dim intSum As Integer Dim intY As Integer Do While intY < 3 For intX As Integer = 1 to 4 intSum += intX Next intX intY += 1 Loop lblSum.Text = intSum.ToString a. 5 b. 8 c. 15 d. 30

30

(Read code carefully, answer with an integer) How many times will the string literal "Hi" appear in the lblMsg control? For intCount As Integer = 6 To 13 Step 2 lblMsg.Text = lblMsg.Text & "Hi" & ControlChars.NewLine Next intCount

4

If the loop's For clause is For intX = 2 to 8 Step 2, how many times will the loop instructions be processed?

4

If the strPresident variable contains the string "Abraham Lincoln", what value will the strPresident.IndexOf("ham") method return? a. True b. -1 c. 4 d. 5

4

If a list box's Sorted property is set to False, how will the numbers 4, 35, 3, 1, and 12 be displayed in the list box? a. 4, 35, 3, 1, 12 b. 1, 3, 4, 12, 35 c. 1, 12, 3, 35, 4 d. 35, 12, 4, 3, 1

4, 35, 3, 1, 12

Explain the difference between a Sub procedure and a Function procedure.

A Function returns a value, a Sub procedure doesn't.

Which of the following is false? a. A function returns only one value to the statement that invoked it b. A Sub procedure can accept only one item of data passed to it c. The parameterList in a procedure header is optional d. None of the above

A Sub procedure can accept only one item of data passed to it

Which of the following statements is false? a. A class can contain only one constructor b. An example of a behavior is the SetTime method in a Time class c. An object created from a class is referred to as an instance of the class d. An instance of a class is considered an object

A class can contain only one constructor

What is a class?

A class is a pattern that the computer uses to create an object.

stands for "active server page"

ASP

Which of a form's properties specifies the default button (if any)?

AcceptButton

A property of a form; used to designate the default button

AcceptButton property

A numeric variable used for accumulating (adding together) something

Accumulator

arrays whose elements are used to accumulate (add together) values

Accumulator arrays

Which of the following methods is used to add items to a list box? a. Add b. AddList c. Item d. ItemAdd

Add

The Items collection's method used to add an item to a list box

Add method

If the strWord variable contains the string "spring", which of the following statements assigns the letter r to the strLetter variable? a. strLetter = strWord.Substring(2) b. strLetter = strWord(2) c. strLetter = strWord(2, 1) d. All of the above

All of the above

The intCounters array contains five elements. Which of the following assigns the number 1 to each element? a. For intSub As Integer = 0 To 4 intCounters(intSub) = 1 Next intSub b. Dim intSub As Integer Do While intSub < 5 intCounters(intSub) = 1 intSub += 1 Loop c. For intSub As Integer = 1 To 5 intCounters(intSub - 1) = 1 Next intSub d. All of the above

All of the above

The strDue variable contains the string "$****75". Which of the following statements removes the dollar sign and asterisks from the variable? a. strDue = strDue.Trim("$"c, "*"c) b. strDue = strDue.TrimStart("*"c, "$"c) c. strDue = strDue.TrimStart("$"c, "*"c) d. All of the above

All of the above

Which of the following assigns the number 0 to each element in a two-row, four-column Integer array named intSums? a. For intRow As Integer = 0 To 1 For intCol As Integer = 0 To 3 intSums(intRow, intCol) = 0 Next intCol Next intRow b. Dim intRow As Integer Dim intCol As Integer Do While intRow < 2 intCol = 0 Do While intCol < 4 intSums(intRow, intCol) = 0 intCol += 1 Loop intRow += 1 Loop c. For intX As Integer = 1 To 2 For intY As Integer = 1 To 4 intSums(intX - 1, intY - 1) = 0 Next intY Next intX d. All of the above

All of the above

Which of the following clauses will stop the loop when the value in the intPopulation variable is less than the number 5000? a. Do While intPopulation >= 5000 b. Do Until intPopulation < 5000 c. Loop While intPopulation >= 5000 d. All of the above

All of the above

Which of the following selects the Cat item, which appears third in the cboAnimal control? a. cboAnimal.SelectedIndex = 2 b. cboAnimal.SelectedItem = "Cat" c. cboAnimal.Text = "Cat" D. All of the above

All of the above

Which of the following statements changes the contents of the strZip variable from 60521 to 60461? a. strZip = strZip.Insert(2, "46") strZip = strZip.Remove(4, 2) b. strZip = strZip.Remove(2) strZip = strZip.Insert(2, "461") c. strZip = strZip.Remove(2, 2) strZip = strZip.Insert(2, "46") d. All of the above

All of the above

used with a StreamWriter variable to open a sequential access file for append

AppendText method

When a list box's Sorted property is set to True, in what order will the following items appear: Banana, Apple, Watermelon?

Apple, Banana, Watermelon

the items of information in a calling statement; items passed to a Sub procedure, function, or method

Arguments

a group of related variables that have the same name and data type and are stored in consecutive locations in the computer's main memory

Array

a string; also called a character array

Array of characters

reverses the order of the values stored in a one-dimensional array

Array.Reverse method

sorts the values stored in a one-dimensional array in ascending order

Array.Sort method

Which of the following statements sorts the intQuantities array in ascending order? a. Array.Sort(intQuantities) b. intQuantities.Sort c. Sort(intQuantities) d. SortArray(intQuantities)

Array.Sort(intQuantities)

the characteristics that describe an object

Attributes

the Visual Basic feature that enables you to specify the property of a class in one line

Auto-implemented properties

an object's methods and events

Behaviors

Scope of the variable declared in a For...Next statement's For clause; indicates that the variable can be used only within the For...Next loop

Block scope

The dblNums array is a six-element Double array. Which of the following If clauses determines whether the entire array has been searched? a. If intSub = dblNums.Length Then b. If intSub <= dblNums.Length Then c. If intSub > dblNums.GetUpperBound(0) Then d. Both a and c

Both a and c

Which of the following declares a five-element one-dimensional array? a. Dim intSold(4) As Integer b. Dim intSold(5) As Integer = {4, 78, 65, 23, 2} c. Dim intSold() As Integer = {4, 78, 65, 23, 2} d. Both a and c

Both a and c

Which of the following is a valid header for a procedure that is passed the number 15? a. Private Function GetTax(ByVal intRate as Integer) As Decimal b. Private Function GetTax(ByAdd intRate as Integer) As Decimal c. Private Sub CalcTax(ByVal intRate as Integer) d. Both a and c

Both a and c

a program that allows a client computer to request and view Web pages

Browser

Write the parameterList for a procedure that receives a Decimal value followed by the address of a Decimal variable. Use decSales and decBonus as the parameter names.

ByVal decSales As Decimal, ByRef decBonus As Decimal

Write a calling statement that invokes an independent Sub procedure named CalcBonus, passing it the value stored in the decFebSales variable and the address of the decFebBonus variable.

CalcBonus(decFebSales, decFebBonus)

a statement that invokes (calls) an independent Sub procedure or function

Calling statement

a property of the e parameter in the form's FormClosing event procedure; when set to True, it prevents the form from closing

Cancel property

A property of a form; used to designate the button that can be selected by pressing the Esc key

CancelButton property

a string; a group (or array) of related characters

Character array

a sequence (stream) of characters

Character stream

a digit that is added to either the beginning or end (but typically the end) of a number for the purpose of validating the number's authenticity

Check digit

a pattern that the computer follows when instantiating (creating) an object

Class

the statement used to define a class in Visual Basic

Class statement

The Items collection's method used to clear (remove) items from a list box

Clear method

a computer that requests information from a Web server

Client computer

used with either a StreamWriter variable or a StreamReader variable to close a sequential access file

Close method

A group of individual objects treated as one unit

Collection

a control that offers the user a list of choices and also has a text field that may or may not be editable

Combo box

The ampersand (&); used to concatenate strings

Concatenation operator

a method whose instructions are automatically processed each time the class is used to instantiate an object; used to initialize the class' Private variables; always a Sub procedure named New

Constructor

performs a case-sensitive search to determine whether a string contains a specific sequence of characters; returns a Boolean value (True or False)

Contains method

Advances the insertion point to the next line

ControlChars.NewLine constant

Which constant is used to represent the Tab key?

ControlChars.Tab

Represents the Tab key

ControlChars.Tab constant

Stores an integer that represents the number of items in the Items collection

Count property

A numeric variable used for counting something

Counter

arrays whose elements are used for counting something

Counter array

A loop whose processing is controlled by a counter; the loop body will be processed a precise number of times

Counter-controlled loop

If the file to be opened exists, which method erases the file's contents? a. AppendText b. CreateText c. InsertText d. OpenText

CreateText

used with a StreamWriter variable to open a sequential access file for output

CreateText method

Decreasing a value

Decrementing

The button that can be selected by pressing the Enter key even when the button does not have the focus; designated by setting the form's AcceptButton property

Default button

a constructor that has no parameters; a class can have only one default constructor

Default constructor

The item automatically selected in a list box when the application is started and the interface appears

Default list box item

If the user clicks the Cancel button in a message box, the MessageBox.Show method returns the integer 2, which is represented by which DialogResult value?

DialogResult.Cancel

Numbers are sorted before letters, and a lowercase letter is sorted before its uppercase equivalent

Dictionary order

Which of the following instantiates an Inventory object and assigns it to the chair variable? a. Dim chair As Inventory b. Dim chair As New Inventory c. Dim chair = New Inventory d. Dim New chair As Inventory

Dim chair As New Inventory

Which of the following declares a two-dimensional array that has four rows and three columns? a. Dim decNums(2, 3) As Decimal b. Dim decNums(3, 4) As Decimal c. Dim decNums(3, 2) As Decimal d. Dim decNums(4, 3) As Decimal

Dim decNums(3, 2) As Decimal

Write a statement that declares a procedure-level Employee variable named hourly. The statement should also instantiate an Employee object, storing it in the hourly variable.

Dim hourly As New Employee

Write a declaration statement for a procedure-level variable named inInventory. The variable will be used to read data from a sequential access file.

Dim inInventory As IO.StreamReader

Write a statement that declares a procedure-level one-dimensional array named intOrders. The array should contain 15 elements.

Dim intOrders(14) As Integer

Write a statement that declares a procedure-level Employee variable named manager.

Dim manager As Employee

Write a declaration statement for a procedure-level variable named outInventory. The variable will store a StreamWriter object.

Dim outInventory As IO.StreamWriter

Which of the following statements declares an object to represent the pseudo-random number generator in a procedure? a. Dim randGen As New RandomNumber b. Dim randGen As New Generator c. Dim randGen As New Random d. Dim randGen As New RandomObject

Dim randGen As New Random

Write a Dim statement that creates a Random object named randGen.

Dim randGen As New Random

Write a statement that invokes the DisplayCompanyName procedure, which has no parameters.

DisplayCompanyName()

Write a Do clause that processes the loop instructions until the end of the file is reach. The file is associated with inInventory.

Do Until inInventory.Peek = -1

Using the Until keyword, write a Do clause that processes the loop body as long as the value in the intAge variable is less than or equal to 21.

Do Until intAge <= 21

Using the Until keyword, write a Do clause that stops the loop when the value in the strContinue contains the letter N (in uppercase).

Do Until strContinue.ToUpper = "N"

Using the While keyword, write a Do clause that processes the loop body as long as the value in the dblScore variable is greater than 0 and, at the same time, less than or equal to 100.

Do While dblScore > 0 AndAlso dblScore <= 100

Using the While keyword, write a Do clause that processes the loop body as long as the value in the intAge variable is greater than 21.

Do While intAge > 21

The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal, intSub, and dblAvg variables contain the number 0 before the loop is processed. a. Do While intSub < 4 intNums(intSub) = intTotal + intTotal intSub += 1 Loop dblAvg = intTotal / intSub b. Do While intSub < 4 intTotal += intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub c. Do While intSub < 4 intTotal += intNums(intSub) intSub += 1 Loop dblAvg = intTotal / intSub - 1 d. Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / (intSub - 1)

Do While intSub < 4 intTotal += intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub

The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following loops will correctly multiply each element by 2? The intSub variable contains the number 0 before the loop is processed. a. Do While intSub <= 4 intSub *= 2 Loop b. Do While intSub <= 4 intSales *= 2 intSub += 1 Loop c. Do While intSub < 5 intSales(intSub) *= 2 intSub += 1 Loop d. None of the above

Do While intSub < 5 intSales(intSub) *= 2 intSub += 1 Loop

The strItems array is declared as follows: Dim strItems(20) As String. The intSub variable keeps track of the array subscripts and is initialized to 0. Which of the following Do clauses will process the loop instructions for each element in the array? a. Do While intSub > 20 b. Do While intSub < 20 c. Do While intSub >= 20 d. Do While intSub <= 20

Do While intSub > 20

A Visual Basic statement that can be used to code both pretest loops and posttest loops

Do...Loop statement

The Financial.Pmt method returns a number of which data type?

Double

Which style of combo box has a text portion that is not editable?

DropDownList

Which property is used to specify a combo box's style? a. ComboBoxStyle b. DropDownStyle c. DropStyle d. Style

DropDownStyle

determines the style of a combo box

DropDownStyle property

an interactive document that can accept information from the user and also retrieve information for the user

Dynamic Web page

the variables in an array

Elements

use to enable (True) or disable (False) a control during run time

Enabled property

an OOP term that means "contains" in a class

Encapsulates

A loop whose instructions are processed indefinitely; also called an infinite loop

Endless loop

Sub procedures that are processed only when a specific event occurs; also called event-handling Sub procedures

Event procedures

procedures that are processed only when a specific event occurs; also called event procedures

Event-handling Sub procedures

the actions to which an object can respond

Events

used to determine whether a file exists

Exists method

in OOP, this term refers to the fact that an object's Public members are visible to an application

Exposed

(True of False) A class is an object.

False

(True or False) An object's attributes indicate the tasks that the object can perform.

False

(True or False) In order to access each element in an array, the For Each...Next statement needs to know the highest subscript in the array.

False

(True or False) Only the For...Next statement can be used to code a nested loop.

False

(True or False) The code to traverse a two-dimensional array using the For Each...Next statement requires two loops.

False

(True or False) When using two loops to traverse an array, you can use the For...Next statement to code the outer loop and use the For Each...Next statement to code the nested loop.

False

(True or False) Without using the line continuation character, you can break a line of code immediately before a comma.

False

A WriteOnly property can be an auto-implemented property. a. True b. False

False

What does the Contains method return when the string does not contain the subString?

False

Used to calculate the periodic payment on either a loan or an investment

Financial.Pmt method

moves the focus to a specified control during run time

Focus method

When traversing an array, which of the following statements does not need to keep track of the individual array subscripts: Do...Loop, For...Next, or For Each...Next?

For Each...Next

used to code a loop whose instructions should be processed for each element in a group

For Each...Next statement

Write a For clause that repeats the loop body instructions 10 times. Use intX as the counter variable's name, and declare the variable in the For clause.

For intX As Integer = 1 to 10

Which of the following For clauses indicates that the loop instructions should be processed as long as the intX variable's value is less than 100? a. For intX as Integer = 10 To 100 b. For intX as Integer = 10 To 99 c. For intX as Integer = 10 To 101 d. None of the above

For intX as Integer = 10 To 99

Which of the following statements can be used to code a loop whose instructions you want processed 10 times? a. Do...Loop b. For...Next c. All of the above

For...Next

A Visual Basic statement that is used to code a specific type of pretest loop, called a counter-controlled loop

For...Next statement

Which of a form's events is triggered when you click the Close button on its title bar? a. FormClose b. FormClosing c. FormExit d. None of the above

FormClosing

occurs when a form is about to be closed, which can happen as a result of the computer processing the Me.Close() statement or the user clicking the Close button on the form's title bar

FormClosing event

another name for Function procedures

Function

a procedure that returns a value after performing its assigned task; also referred to more simply as a function

Function procedure

The Return statement is entered in which statement in a Property procedure? a. Get b. Set

Get

the section of a Property procedure that contains the Get statement

Get block

appears in a Get block in a Property procedure; contains the code that allows an application to retrieve the contents of the Private variable associated with the property

Get statement

Which of the following statements invokes the GetArea Sub procedure, passing it two variables by value? a. GetArea(dblLength, dblWidth) As Double b. GetArea(ByVal dblLength, ByVal dblWidth) c. GetArea ByVal(dblLength, dblWidth) d. GetArea(dblLength, dblWidth)

GetArea(ByVal dblLength, ByVal dblWidth)

returns an integer that represents the highest subscript in a specified dimension of an array; when used with a one-dimensional array, the dimension is 0; when used with a two-dimensional array, the dimension is 0 for the row subscript and 1 for the column subscript

GetUpperBound method

in OOP, this term refers to the fact that object's Private members are not visible to an application

Hidden

In code, you refer to a control on a Web page by using which of the following properties? a. Caption b. ID c. Name d. Text

ID

Which of the following can be used to determine whether the employ.txt file exists? a. If IO.File.Exists("employ.txt") Then b. If IO.File("employ.txt").Exists Then c. If IO.Exists("employ.txt") = True Then d. If IO.Exists.File("employ.txt") = True Then

If IO.File.Exists("employ.txt") Then

Write an If clause that determines whether the inventory.txt file exists.

If IO.File.Exists("inventory.txt") Then

The intNum array is declared as follows: Dim intNum(,) As Integer = {{6, 12, 9, 5, 2}, {35, 60, 17, 8, 10}}. Which of the following If clauses determines whether the intRow and intCol variables contain valid row and column subscripts, respectively, for the array? a. If intNum(intRow, intCol) >= 0 AndAlso intNum(intRow, intCol) < 5 Then b. If intNum(intRow, intCol) >= 0 AndAlso intNum(intRow, intCol) <= 5 Then c. If intRow >= 0 AndAlso intRow < 3 AndAlso intCol >= 0 AndAlso intCol < 6 Then d. If intRow >= 0 AndAlso intRow < 2 AndAlso intCol >= 0 AndAlso intCol < 5 Then

If intNum(intRow, intCol) >= 0 AndAlso intNum(intRow, intCol) < 5 Then

The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following If clauses determines whether the intSub variable contains a valid subscript for the array? a. If intSub >= 0 AndAlso intSub <= 4 Then b. If intSub >= 0 AndAlso intSub < 4 Then c. If intSub >= 0 AndAlso intSub <= 5 Then d. If intSub > 0 AndAlso intSub < 5 Then

If intSub >= 0 AndAlso intSub <= 4 Then

Write an If clause that determines whether the strInput variable contains two numbers followed by an uppercase letter.

If strInput Like "##[A-Z]" Then

Write an If clause that determines whether the strInput variable contains a dollar sign followed by a number and a letter (in uppercase or lowercase).

If strInput Like "[$]#[a-zA-Z]" Then

Increasing a value

Incrementing

procedures that are not connected to any object and event; the procedure is processed only when called (invoked) from code

Independent Sub procedures

performs a case-sensitive search to determine whether a string contains a specific sequence of characters; returns either -1 (if the string does not contain the sequence of characters) or an integer that represents the starting position of the sequence of characters

IndexOf method

Another name for an endless loop

Infinite loop

files from which an application reads data

Input files

inserts characters anywhere in a string

Insert method

an object created from a class

Instance

the process of creating an object from a class

Instantiated

If the first parameter has the Integer data type and the second parameter has the Double data type, what data types should the first and second arguments have?

Integer, Double

The items in a combo box belong to which collection? a. Items b. List c. ListBox d. Values

Items

The items in a list box belong to which collection?

Items

The items in a list box belong to which collection? a. Items b. List c. ListItems d. Values

Items

The collection of items in a list box

Items collection

one of the properties of a one-dimensional array; stores an integer that represents the number of array elements

Length property

stores an integer that represents the number of characters contained in a string

Length property

uses pattern-matching characters to determine whether one string is equal to another string; performs a case-sensitive comparison

Like operator

a sequence (stream) of characters followed by the newline character

Line

an underscore that is immediately preceded by a space and located at the end of a physical line of code in the Code Editor window; used to split a long instruction into two or more physical lines

Line continuation character

A control used to display a list of items from which the user can select zero items, one item, or multiple items

List box

An event associated with a form; occurs when the application is started and the form is displayed the first time

Load event

Another name for the repetition structure

Loop

Using the Until keyword, write a Loop clause that processes the loop body as long as the value in the intAge variable is less than or equal to 21.

Loop Until intAge <= 21

Using the Until keyword, write a Loop clause that stops the loop when the value in the strContinue variable contains the letter N (in uppercase).

Loop Until strContinue.ToUpper = "N"

Using the While keyword, write a Loop clause that processes the loop body as long as the value in the dblScore variable is greater than 0 and, at the same time, less than or equal to 100.

Loop While dblScore > 0 AndAlso dblScore <= 100

Using the While keyword, write a Loop clause that processes the loop body as long as the value in the intAge variable is greater than 21.

Loop While intAge > 21

The requirement that must be met for the computer to STOP processing the loop body instructions

Loop exit condition

The requirement that must be met for the computer to CONTINUE processing the loop body instructions

Looping condition

rounds a numeric value to a specific number of decimal places

Math.Round method

Which property specifies the number of characters that a text box will accept? a. Length b. MaxLength c. LengthMax d. Maximum

MaxLength

a property of a text box control; specifies the maximum number of characters the control will accept

MaxLength property

the variables declared in the attributes section of a class

Member variables

used to include one or more menus on a form; instantiated using the MenuStrip tool located in the Menus & Toolbars section of the toolbox

Menu strip control

displays a message box that contains text, one or more buttons, and an icon; allows an application to communicate with the user while the application is running

MessageBox.Show method

Which constant displays the Exclamation icon in a message box? a. MessageBox.Exclamation b. MessageBox.IconExclamation c. MessageBoxIcon.Exclamation d. MessageBox.WarningIcon

MessageBoxIcon.Exclamation

What constant is associated with the Information in the MessageBox.Show method?

MessageBoxIcon.Information

the actions that an object is capable of performing

Methods

Which of a text box's properties determines whether the text box can accept either one or multiple lines of text?

Multiline

A property of a text box; indicates whether the text box can accept and display either one or multiple lines of text

Multiline property

Which of the following is the name of the Inventory class's default constructor? a. Inventory b. InventoryConstructor c. Default d. New

New

The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal variable contains the number 0 before the loop is processed. a. For Each intX As Integer In intNums intTotal += intX Next intX dblAvg = intTotal / intNums.Length b. For Each intX As Integer In intNums intTotal += intNums(intX) Next intX dblAvg = intTotal / intX c. For Each intX As Integer In intNums intTotal += intNums(intX) intX += 1 Next intX dblAvg = intTotal / intX d. None of the above

None of the above

What type of object is created by the OpenText method? a. File b. SequenceReader c. StreamWriter d. None of the above

None of the above

the acronym for object-oriented programming

OOP

anything that can be seen, touched, or used

Object

a programming language that allows the use of objects in an application's interface and code

Object-oriented programming language

an array whose elements are identified by a unique subscript

One-dimensional array

used with a StreamReader variable to open a sequential access file for input

OpenText method

files to which an application writes data

Output files

Occurs when the value assigned to a memory location is too large for the location's data type

Overflow error

two or more class methods that have the same name but different parameterLists

Overloaded methods

Which method right-aligns a string? a. PadLeft b. PadRight c. LeftAlign d. RightAlign

PadLeft

right-aligns a string by inserting characters at the beginning of the string

PadLeft Method

left-aligns a string by inserting characters at the end of the string

PadRight Method

two or more one-dimensional arrays whose elements are related by their subscripts (positions) in the arrays

Parallel one-dimensional arrays

a constructor that contains one or more parameters

Parameterized constructor

memory locations (variables) declared in a procedure header; accepts the information passed to the procedure

Parameters

used when naming Sub procedures and functions; the practice of capitalizing the first letter in the name and the first letter of each subsequent word in the name

Pascal case

refers to the process of passing a variable's address to a procedure so that the value in the variable can be changed

Passing by reference

refers to the process of passing a copy of a variable's value to a procedure

Passing by value

Explain the difference between passing a variable by value and passing it by reference.

Passing by value makes a copy of the variable, passing by reference passes the memory address.

Which property allows you to specify a specific character that will always be displayed in a text box, no matter what character the user types? a. Char b. CharPassword c. Password d. PasswordChar

PasswordChar

specifies the characters used to hide the user's input

PasswordChar property

used with a StreamReader variable to determine whether a file contains another character to read

Peek method

refers to the process of initializing the elements in an array

Populating the array

occurs when the information on a dynamic Web page is sent (posted) back to a server for processing

Postback

A loop whose condition is evaluated AFTER the instructions in its loop body are processed

Posttest loop

A loop whose condition is evaluated BEFORE the instructions in its loop body are processed

Pretest loop

To hide one of a class's members, you declare the member using which of the following keywords? a. Hide b. Invisible c. Private d. ReadOnly

Private

A function named GetBonus receives a Double value and returns a Double value. Write the function header, using dblSales as the parameter name.

Private Function GetBonus(byVal dblSales As Double) As Double

Which of the following is a valid header for a procedure that receives a copy of the value stored in a String variable? a. Private Sub DisplayName(ByCopy strName As String) b. Private Sub DisplayName ByVal(strName As String) c. Private Sub DisplayName(ByVal strName As String) d. None of the above

Private Sub DisplayName(ByVal strName As String)

A Sub procedure named GetEndInv is passed four Integer variables from its calling statement. The first three variables store the following three values: beginning inventory, number sold, and number purchased. The procedure should use these values to calculate the ending inventory, and then store the result in the fourth variable. Which of the following headers is correct? a. Private Sub GetEndInv(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As Integer, ByRef intFinal As Integer) b. Private Sub GetEndInv(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As Integer, ByVal intFinal As Integer) c. Private Sub GetEndInv(ByRef intB as Integer, ByRef intS As Integer, ByRef intP As Integer, ByVal intFinal As Integer) d. Private Sub GetEndInv(ByRef intB As Integer, ByRef intS As Integer, ByRef intP As Integer, ByRef intFinal as Integer)

Private Sub GetEndInv(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As Integer, ByRef intFinal As Integer)

Which of the following is a valid header for a procedure that receives the address of a Decimal variable followed by an integer? a. Private Sub GetFee(ByVal decX As Decimal, ByAdd intY As Integer) b. Private Sub GetFee(decX as Decimal, intY as Integer) c. Private Sub GetFee(ByRef decX as Decimal, ByVal intY as Integer) d. None of the above

Private Sub GetFee(ByRef decX as Decimal, ByVal intY as Integer)

Which of the following is a valid header for a procedure that receives an integer followed by a number with a decimal place? a. Private Sub GetFee(intBase As Value, decRate As Value) b. Private Sub GetFee(ByRef intBase As Integer, ByRef decRate As Decimal) c. Private Sub GetFee(ByVal intBase As Integer, ByVal decRate As Decimal) d. None of the above

Private Sub GetFee(ByVal intBase As Integer, ByVal decRate As Decimal)

Write a statement that declares a class-level two-dimensional array named intOrders. The array should contain five rows and three columns.

Private intOrders(4, 2) As Integer

a mathematical algorithm that produces a sequence of random numbers; in Visual Basic, the psuedo-random generator is represented by an object whose data type is Random

Psuedo-random number generator

creates a Public property that an application can use to access a Private variable in a class

Public property procedure

represents the pseudo-random number generator in Visual Basic

Random object

used to generate a random integer that is greater than or equal to a minimum value but less than a maximum value

Random.Next method

Which of the following controls is used to verify that an entry on a Web page is within minimum and maximum values? a. MinMaxValidation b. MaxMinValidation c. EntryValidator d. RangeValidator

RangeValidator

used with a StreamReader variable to read a line of text from a sequential access file

ReadLine method

Which keyword indicates that a property's value can be displayed but not changed by an application?

ReadOnly

used when defining a Property procedure; indicates that the property's value can only be retrieved (read) by an application

ReadOnly keyword

A property of a text box; specifies whether or not the user can change the contents of the text box

ReadOnly property

used with a StreamReader variable to read a sequential access file, all at once

ReadToEnd method

Numbers with a decimal place

Real numbers

removes a specified number of characters located anywhere in a string

Remove method

The control structure used to repeatedly process one or more program instructions; also called a loop

Repetition structure

replaces a sequence of characters in a string with another sequence of characters

Replace method

Which of the following controls is used to verify that a control on a Web page contains data? a. FieldValidator b. RequiredField c. RequiredFieldValidator d. RequiredValidator

RequiredFieldValidator

Which of the following instructs a function to return the value stored in the dblBonus variable? a. Return dblBonus b. Return byVal dblBonus c. Send dblBonus d. SendBack dblBonus

Return dblBonus

Write the Return statement for Private Function GetBonus(byVal dblSales As Double) As Double. The statement should return the value stored in its dblBonus variable.

Return dblBonus

the Visual Basic statement that returns a function's value to the statement that invoked the function

Return statement

another name for a simple variable

Scalar variable

A property of a text box; specifies whether the text box has no scroll bars, a horizontal scroll bar, a vertical scroll bar, or both a horizontal and vertical scroll bars

ScrollBars property

Which of the following properties stores the index of the item selected in a list box? a. Index b. SelectedIndex c. Selection d. SelectionIndex

SelectedIndex

Which two properties can be used to select a default item in a list box?

SelectedIndex and SelectedItem

Can be used to select an item in a list box and also to determine which item is selected; stores the index of the selected item

SelectedIndex property

Occurs when an item is selected in a list box

SelectedIndexChanged event

Can be used to select an item in a list box and also to determine which item is selected; stores the value of the selected item

SelectedItem property

Which event occurs when the user selects a different item in a list box? a. SelectionChanged b. SelectedItemChanged c. SelectedValueChanged d. None of the above

SelectedValueChanged

Occurs when an item is selected in a list box

SelectedValueChanged event

Determines the number of items that can be selected in a list box

SelectionMode property

files composed of characters that are both read and written sequentially; also called text files

Sequential access files

If you need to validate a value before assigning it to a Private variable, you enter the validation code in which block in a Property procedure? a. Assign b. Get c. Set d. Validate

Set

In a Property procedure, validation code is typically entered in which statement: Get or Set?

Set

the section of a Property procedure that contains the Set statement

Set block

appears in a Set block in a Property procedure; contains the code that allows an application to assign a value to the Private variable associated with the property; may also contain validation code

Set statement

appear to the right of a menu item and allow the user to select the item without opening the menu

Shortcut keys

a method's name combined with its optional parameterList

Signature

a variable that is unrelated to any other variable in the computer's main memory; also called a scalar variable

Simple variable

Specifies whether the list box items should appear in the order they are entered in the list box or in sorted order

Sorted property

A class contains a Private variable named strState. The variable is associated with a Public property named State. Which of the following is the best way for a parameterized constructor to assign the value stored in its strName parameter to the variable? a. strState = strName b. State = strState c. strState = State.strName d. State = strName

State = strName

a noninteractive document whose purpose is merely to display information to the viewer

Static Web page

a sequence of characters; also called a character stream

Stream of characters

the Visual Basic class used to create StreamReader objects

StreamReader class

used to read a sequence (stream) of characters from a sequential access file

StreamReader object

a variable that stores a StreamReader object; used to refer to a sequential access input file in code

StreamReader variable

What type of object is created by the AppendText method? a. File b. SequenceReader c. StreamWriter d. None of the above

StreamWriter

the Visual Basic class used to create StreamWriter objects

StreamWriter class

used to write a sequence (stream) of characters to a sequential access file

StreamWriter object

a variable that stores a StreamWriter object; used to refer to a sequential access output file in code

StreamWriter variable

Provides an easy way to add items to a list box's Items collection

String collection editor

a unique integer that identifies the position of an element in an array

Subscript

used to access any number of characters contained in a string

Substring method

The item that appears in the text portion of a combo box is stored in which property? a. SelectedText b. SelectedValue c. Text d. TextItem

Text

Which property stores the value either selected in the list portion or typed in the text portion of a combo box?

Text

another name for sequential access files

Text files

What event occurs when the value in the text portion of a combo box changes?

TextChanged

Which event occurs when the user either types a value in the text portion of a combo box or selects a different item in the list portion? a. ChangedItem b. ChangedValue c. SelectedItemChanged d. TextChanged

TextChanged

Which of the following is false? a. The order of the arguments listed in the calling statement should agree with the order of the parameters listed in the receiving procedure's header. b. The data type of each argument in the calling statement should match the data type of its corresponding parameter in the procedure header. c. When you pass an item to a procedure by value, the procedure stores the item's value in a separate memory location. d. The name of each argument in the calling statement should be identical to the name of its corresponding parameter in the procedure header.

The name of each argument in the calling statement should be identical to the name of its corresponding parameter in the procedure header.

Which of the following is false? a. When you pass a variable by reference, the receiving procedure can change it's contents. b. To pass a variable by reference, you include the ByRef keyword before the variable's name in the calling statement. c. When you pass a variable by value, the receiving procedure creates a procedure-level variable to store the value passed to it. d. When you pass a variable by value, the receiving procedure cannot change its contents.

To pass a variable by reference, you include the ByRef keyword before the variable's name in the calling statement.

removes characters from both the beginning and the end of a string

Trim method

removes characters from the end of a string

TrimEnd method

removes characters from the beginning of a string

TrimStart method

(True or False) A Private variable in a class can be accessed directly by a Public method in the same class.

True

(True or False) An application must use a Public member of a class to access the class' Private members.

True

(True or False) An object is an instance of a class.

True

(True or False) Counters and accumulators must be initialized.

True

(True or False) Counters and accumulators must be updated.

True

(True or False) Counters are usually updated by a constant amount.

True

(True or False) In order to access each element in an array, the Do...Loop statement needs to know the highest subscript in the array.

True

(True or False) In order to access each element in an array, the For...Next statement needs to know the highest subscript in the array.

True

(True or False) The code to traverse a two-dimensional array using the Do...Loop statement requires two loops.

True

(True or False) The code to traverse a two-dimensional array using the For...Next statement requires two loops.

True

(True or False) The memory locations listed in a procedure header's parameterList have procedure scope and are removed from the computer's main memory when the procedure ends.

True

an array made up of rows and columns; each element has the same name and data type and is identified by a unique combination of two subscripts; a row subscript and a column subscript

Two-dimensional array

the tools contained in the Validation section of the toolbox; used to validate user input on a Web page

Validation tools

the documents stored on Web servers

Web pages

The Visual Basic code in a Web page is processed by which of the following? a. client computer b. Web server

Web server

a computer that contains special software that "serves up" Web pages in response to requests from client computers

Web server

used with a StreamWriter variable to write data to a sequential access file; differs from the WriteLine method in that it does not write a newline character after the data

Write method

used with a StreamWriter variable to write data to a sequential access file; differs from the Write method in that it writes a newline character after the data

WriteLine method

used when defining a Property procedure; indicates that an application can only set (write to) the property's value

WriteOnly keyword

Explain the difference between invoking a Sub procedure and invoking a function.

You invoke an independent Sub procedure using a stand-alone statement that includes the Sub procedure's name followed by zero or more arguments that are separated by commas and enclosed in parentheses. You invoke a function by including the function's name and arguments (if any) in a statement.

Which of the following is false? a. Menu titles should be one word only. b. Each menu title should have a unique access key. c. You should assign shortcut keys to commonly used menu titles. d. Menu items should be entered using book title capitalization.

You should assign shortcut keys to commonly used menu titles.

What is the line continuation character?

_

A class contains an auto-implemented property named Title. Which of the following is the correct way for the default constructor to assign the string "Unknown" to the variable associated with the property? a. _Title = "Unknown" b. _Title.strTitle = "Unknown" c. Title = "Unknown" d. None of the above

_Title = "Unknown"

A constructor is _____________________. a. a function b. a Property procedure c. a Sub procedure d. either a function or a Sub procedure

a Sub procedure

The horizontal line in a menu is called _____________________. a. a menu bar b. a separator bar c. an item separator d. None of the above

a separator bar

If a message is for informational purposes only and does not require the user to make a decision, the message box should display which of the following? a. an OK button and the Information icon b. an OK button and the Exclamation icon c. a Yes button and the Stop icon d. a No button and the Stop icon

an OK button and the Information icon

The underlined letter in a menu element's caption is called _____________________. a. an access key b. a menu key c. a shortcut key d. None of the above.

an access key

What are the items that appear within parentheses in a calling statement called? a. arguments b. parameters c. passers d. None of the above

arguments

Write a statement that uses the Contains method to determine whether the strAddress variable contains the string "Elm St." (in uppercase, lowercase, or a combination of uppercase and lowercase). Assign the return value to the blnIsContained variable.

blnIsContained = strAddress.ToUpper.Contains("ELM ST.")

Which of the following methods can be used to determine whether the strRate variable contains the percent sign? a. blnResult = strRate.Contains("%") b. intResult = strRate.IndexOf("%") c. intResult = strRate.IndexOf("%", 0) d. All of the above

blnResult = strRate.Contains("%")

Which of the following is a program that uses HTML to render a Web page on the computer screen? a. browser b. client c. server d. renderer

browser

Write a statement that prevents the btnCalc control from responding to the user.

btnCalc.Enabled = False

Write a statement that allows the btnCalc control to respond to the user.

btnCalc.Enabled = True

Which of the following statements enables the btnClear control? a. btnClear.Enabled() b. btnClear.Enabled = Yes c. btnClear.Enabled = True d. btnClear.Enable = True

btnClear.Enabled = True

Which of the following statements sends the focus to the btnClear control? a. btnClear.Focus() b. btnClear.Focus() = True c. btnClear.SendFocus() d. btnClear.SetFocus()

btnClear.Focus()

If a statement passes a variable's address, the variable is said to be passed ________________________________________. a. by address b. by content c. by reference d. by value

by reference

The Item class contains a Public method named GetDiscount. The method is a function. An application instantiates an Item object and assigns it to a variable named cellPhone. Which of the following can be used by the application to invoke the GetDiscount method? a. dblDiscount = Item.GetDiscount b. dblDiscount = cellPhone.GetDiscount c. dblDiscount = GetDiscount.cellPhone d. cellPhone.GetDiscount

cellPhone.GetDiscount

A computer that requests an ASP page from a Web server is called a _____________________ computer. a. browser b. client c. requesting d. server

client

Which of the following is responsible for processing a Web page's HTML instructions? a. client computer b. Web server

client computer

Write a statement that invokes the following function Private Function GetBonus(byVal dblSales As Double) As Double passing it the value stored in the dblFebSales variable. The statement should assign the return value to the dblFebBonus variable.

dblFebBonus = GetBonus(dblFebSales)

Write a statement that rounds the value stored in the dblRate variable to one decimal place and then assigns the result to the variable.

dblRate = Math.Round(dblRate, 1)

Which of the following rounds the contents of the dblSales variable to two decimal places? a. dblSales = Math.Round(dblSales, 2) b. dblSales = Math.Round(2, dblSales) c. dblSales = Round.Math(dblSales, 2) d. dblSales = Round.Math(2, dblSales)

dblSales = Math.Round(dblSales, 2)

Which of the following statements is equivalent to the statement dblTotal = dblTotal + dblSales? a. dblTotal += dblSales b. dblSales += dblTotal c. dblTotal =+ dblSales d. dblSales =+ dblTotal

dblTotal += dblSales

Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSales and decRate? The statement should assign the function's return value to the decDiscount variable. a. decDiscount = GetDiscount(ByVal decSales, ByVal decRate b. GetDiscount(decSales, decRate, decDiscount) c. decDiscount = GetDiscount(decSales, decRate) d. None of the above

decDiscount = GetDiscount(decSales, decRate)

Which of the following returns the highest column subscript in a two-dimensional array named decPays? a. decPays.GetUpperBound(1) b. decPays.GetUpperBound(0) c. decPays.GetUpperSubscript(0) d. decPays.GetHighestColumn(0)

decPays.GetUpperBound(1)

Write an assignment statement that increments the decTotal variable by the value in the decRegion variable. Use an arithmetic assignment operator.

decTotal += decRegion

An online form used to purchase a product is an example of which type of Web page? a. dynamic b. static

dynamic

When entered in a form's FormClosing procedure, what statement prevents the computer from closing the form?

e.Cancel = True

Which of the following statements prevents a form from being closed? a. e.Cancel = False b. e.Cancel = True c. e.Close = False d. e.sender.Close = Flase

e.Cancel = True

To make the btnCalc control the default button, you need to set the _______________ property. a. btnCalc's AcceptButton b. btnCalc's DefaultButton c. form's AcceptButton d. form's DefaultButton

form's AcceptButton

Using inInventory, write a statement to open a sequential access file named inventory.txt for input.

inInventory = IO.File.OpenText("inventory.txt")

Write a statement to close the file associated with inInventory.

inInventory.Close()

If the intNums array contains six elements, which of the following statements assigns the number 6 to the intElements variable? a. intElements = Len(intNums) b. intElements = Length(intNums) c. intElements = intNums.Len d. intElements = intNums.Length

intElements = intNums.Length

Write a statement that uses the IndexOf method to determine whether the strAddress variable contains the string "Elm St." (in uppercase, lowercase, or a combination of uppercase and lowercase). Assign the return value to the intIndex variable.

intIndex = strAddress.ToUpper.IndexOf("ELM ST.")

Write a statement that assigns the highest column subscript in the intOrders array to the intLastColSub variable.

intLastColSub = intOrders.GetUpperBound(1)

Write a statement that assigns the highest subscript in the intOrders array to the intLastSub variable.

intLastSub = intOrders.GetUpperBound(0)

The strNames array contains 100 elements. Which of the following statements assigns the number 99 to the intLastSub variable? a. intLastSub = strNames.Length b. intLastSub = strNames.GetUpperBound(0) + 1 c. intLastSub = strNames.GetUpperBound(0) d. Both a and b.

intLastSub = strNames.GetUpperBound(0)

Write an assignment statement that decrements the intNum counter variable by 5. Use an arithmetic assignment operator.

intNum -= 5

Write a statement that assigns the number of elements in the intOrders array to the intNum variable.

intNum = intOrders.Length

Which of the following statements generates a random integer from 1 to 25 (including 25)? a. intNum = randGen.Next(1, 25) b. intNum = randGen.Next(1, 26) c. intNum = randGen(1, 25) d. intNum = randGen.NextNumber(1, 26)

intNum = randGen.Next(1, 26)

Using randGen, write a statement that assigns a random integer from 2 to 25 (excluding 25) to the intNum variable.

intNum = randGen.Next(2, 25)

Using randGen, write a statement that assigns a random integer from 25 to 100 (including 100) to the intNum variable.

intNum = randGen.Next(25, 101)

Which of the following assigns the number of characters in the strAddress variable to the intNum variable? a. intNum = strAddress.Length b. intNum = strAddress.LengthOf c. intNum = Length(strAddress) d. intNum = LengthOf(strAddress)

intNum = strAddress.Length

If the strMsg variable contains the string "Her birthday is Friday!", which of the following assigns the number 16 to the intNum variable? a. intNum = strMsg.Substring(0, "F") b. intNum = strMsg.Contains("F") c. intNum = strMsg.IndexOf("F") d. intNum = strMsg.IndexOf(0, "F")

intNum = strMsg.IndexOf("F")

Write a statement that assigns the number of characters in the strZip variables to the intNum variables.

intNum = strZip.Length

Write a statement that assigns the number of items in the lstPrices control to the intNumPrices variable.

intNumPrices = lstPrices.Items.Count

Write a statement that updates the second element in the intOrders array by the value stored in the intSold variable.

intOrders (1) += intSold

Write a statement that subtracts the number 10 from the first element in the intOrders array.

intOrders(0) -= 10

Write a statement that assigns the number 150 to the third element in the intOrders array.

intOrders(2) = 150

Write a statement that assigns the number 150 to the element located in the fourth row, third column in the intOrders array.

intOrders(3, 2) = 150

The items in the intOrders array are associated with the items listed in the lstProducts control. Write a statement that assigns the array value associated with the selected list box items to the intQuantity variable.

intQuantity = intOrders(lstProducts.SelectedIndex)

Write an assignment statement that increments the intRegistered counter variable by 2. Use an arithmetic assignment operator.

intRegistered += 2

Write a statement that assigns the number of rows in the intOrders array to the intRows variable.

intRows = intOrders.GetUpperBound(0) + 1

The Purchase class contains a ReadOnly property named Tax. The property is associated with the Private dblTax variable. A button's Click event procedure instantiates a Purchase object and assigns it to the currentSale variable. Which of the following is valid in the Click event procedure? a. lblTax.Text = currentSale.Tax.ToString("C2") b. currentSale.Tax = 15 c. currentSale.Tax = dblPrice * 0.05 d. None of the above

lblTax.Text = currentSale.Tax.ToString("C2")

Which of the following statements selects the fourth item in the lstNames control? a. lstNames.SelectIndex = 3 b. lstNames.SelectIndex = 4 c. lstNames.SelectedIndex = 3 d. lstNames.SelectedItem = 4

lstNames.SelectedIndex = 3

Write an Add method that adds the contents of the decPrice variable to the lstPrices control.

lstPrices.Items.Add(decPrice)

Write a statement that removes the items from the lstPrices control.

lstPrices.Items.Clear()

Write a statement that instantiates an Employee and assigns it to the manager variable.

manager = New Employee

The Inventory class contains a Private variable named strId. The variable is associated with the Public ItemId property. An application instantiates an Inventory object and assigns it to a variable named onHand. Which of the following can be used by the application to assign the string "XG45" to the strId variable? a. onHand.ItemId = "XG45" b. ItemId.strId = "XG45" c. onHand.strId = "XG45" d. ItemId.strId = "XG45"

onHand.ItemId = "XG45"

Which of the following opens the employ.txt file and allows the computer to write new data to the end of the file's existing data? a. outFile = IO.File.AddText("employ.txt") b. outFile = IO.File.AppendText("employ.txt") c. outFile = IO.File.InsertText("employ.txt") d. outFile = IO.File.WriteText("employ.txt")

outFile = IO.File.AppendText("employ.txt")

Using outInventory, write a statement to open a sequential access file named inventory.txt for output.

outInventory = IO.File.CreateText("inventory.txt")

Write a statement to close the file associated with outInventory.

outInventory.Close()

Using outInventory, write a statement that writes the content of the strId variable on a separate line in the file.

outInventory.WriteLine(strId)

Two or more methods that have the same name but different parameterLists are referred to as what type of methods? a. loaded b. overloaded c. parallel d. signature

overloaded

If the elements in two arrays are related by their subscripts, the arrays are called _____________________ arrays. a. associated b. coupled c. matching d. parallel

parallel

What is an item within parentheses in a procedure header called?

parameter

What are the items that appear within parentheses in a procedure header called? a. arguments b. parameters c. passers d. None of the above

parameters

Which of the following occurs when a user clicks a Submit button on a Web page? a. backpost b. clientpost c. postback d. serverpost

postback

The instructions in a _______________ loop might not be processed at all, whereas the instructions in a _______________ loop are always processed at least once. a. posttest, pretest b. pretest, posttest

pretest, posttest

The intNum array is declared as follows: Dim intNum(,) As Integer = {{6, 12, 9, 5, 2}, {35, 60, 17, 8, 10}}. The intNum(1, 4) = intNum(1, 2) - 5 statement will _____________________. a. replace the 10 amount with 12 b. replace the 5 amount with 7 c. replace the 2 amount with 4 d. None of the above.

replace the 10 amount with 12

The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. The statement intSales(2) += 10 will _____________________. a. replace the 900 amount with 10 b. replace the 900 amount with 910 c. replace the 12000 amount with 10 d. replace the 12000 amount with 12010

replace the 900 amount with 910

Which of the following allows the user to access a menu item without opening the menu? a. an access key b. a menu key c. shortcut keys d. None of the above

shortcut keys

The method name combined with the method's optional parameterList is called the method's _____________________. a. autograph b. inscription c. signature d. statement

signature

The strAmount variable contains the string "678.95". Which of the following statements changes the contents of the variable to the string "678.95!!!"? a. strAmount = strAmount.PadRight(9, "!") b. strAmount = strAmount.PadRight(9, "!"c) c. strAmount = strAmount.PadRight(3, "!"c) d. None of the above

strAmount = strAmount.PadRight(3, "!"c)

The strAmount variable contains the string "1,234". Write a statement that uses the Remove method to change the variable's contents to "1234".

strAmount = strAmount.Remove(1, 1)

Write a statement that uses the PadRight method to change the contents of the strBonus variable from "100" to "100$$$".

strBonus = strBonus.PadRight(6, "$"c)

The strStates and strCapitals arrays are parallel arrays. If Illinois is stored in the second element in the strStates array, where is its capital (Springfield) stored? a. strCapitals(1) b. strCapitals(2)

strCapitals(1)

The strItem variable contains the string "XMredBQ". Write a statement that uses the Substring method to assign the string "red" to the strColor variable.

strColor = strItem.Substring(2, 3)

The strName variable contains the string "Jane H. Does". Write a statement that use the Index method to assign the string "H" to the strInitial variable.

strInitial = strName(5)

The strName variable contains the string "Jane H. Doe". Write a statement that uses the Substring method to assign the string "H" to the strInitial variable.

strInitial = strName.Substring(5, 1)

Which of the following expressions evaluates to True when the strItem variable contains the string "1234Y5"? a. strItem Like "####[A-Z]#" b. strItem Like "9999[A-Z]9" c. strItem Like "######" d. None of the above.

strItem Like "9999[A-Z]9"

If the strWord variable contains the string "crispy", which of the following statements assigns the letter s to the strLetter variable? a. strLetter = strWord.Substring(3) b. strLetter = strWord.Substring(3, 1) c. strLetter = strWord.Substring(4, 1) d. None of the above

strLetter = strWord.Substring(3, 1)

The strName variable contains the string "Doe Jane". Which of the following changes the variable's contents to the string "Doe, Jane"? a. strName = strName.Insert(3, ",") b. strName = strName.Insert(4, ",") c. strName = strName.AddTo(3, ",") d. None of the above

strName = strName.Insert(3, ",")

If the strName variable contains the string "Sharon Kelper", which of the following changes the contents of the variable to the string "Sharon P. Kelper"? a. strName = strName.Insert(6, " P.") b. strName = strName.Insert(7, " P.") c. strName = strName.Insert(8, "P. ") d. None of the above.

strName = strName.Insert(7, " P.")

The strName variable contains the string "Jeffers". Which of the following statements changes the contents of the variable to the string "Jeff"? a. strName = strName.Remove(4) b. strName = strName.Remove(5) c. strName = strName.Remove(5, 3) d. strName = strName.Remove(3, 5)

strName = strName.Remove(4)

Which of the following assigns the string "Rover" to the fifth element in a one-dimensional array named strPetNames? a. strPetNames(4) = "Rover" b. strPetNames[4] = "Rover" c. strPetNames(5) = "Rover" d. strPetNames.Items.Add(5) = "Rover"

strPetNames(4) = "Rover"

Write a statement that reads a line of text from the file associated with inInventory. Assign the line of text to the strProduct variable.

strProduct = inInventory.ReadLine

Which of the following statements changes the contents of the strSocSec variable from "000-11-2222" to "000112222"? a. strSocSec = strSocSec.Remove("-") b. strSocSec = strSocSec.RemoveAll("-") c. strSocSec = strSocSec.Replace("-","") d. strSocSec = strSocSec.ReplaceAll("-")

strSocSec = strSocSec.Replace("-","")

Write a statement that uses the Insert method to change the contents of the strState variables from "Ky" to "Kentucky".

strState = strState.Insert(1, "entuck")

Which of the following statements assigns the string "California" to the element located in the fourth column, sixth row in the two-dimensional strStates array? a. strStates(3, 5) = "California" b. strStates(5, 3) = "California" c. strStates(6, 3) = "California" d. strStates(3, 6) = "California"

strStates(5, 3) = "California"

Which of the following reads a line of text from a sequential access file and assigns the line (excluding the newline character) to the strText variable? a. inFile.Read(strText) b. inFile.ReadLine(strText) c. strText = inFile.ReadLine d. strText = inFile.Read(line)

strText = inFile.ReadLine

The strTotal variable contains the string "***75.67". Write a statement that uses the Replace method to change the variable's contents to "75.67".

strTotal = strTotal.Replace("*", "")

The strTotal variable contains the string "***75.67". Write a statement that uses the TrimStart mothod to change the variable's contents to "75.67".

strTotal = strTotal.TrimStart("*"c)

Which of the following statements assigns the first four characters in the strItem variable to the strWarehouse variable? a. strWarehouse = strItem.Assign(0, 4) b. strWarehouse = strItem.Assign(1, 4) c. strWarehouse = strItem.Substring(0, 4) d. strWarehouse = strItem.Substring(1, 4)

strWarehouse = strItem.Substring(0, 4)

Which of the following statements changes the contents of the strWord variable from "led" to "lead"? a. strWord = strWord.AddTo(2, "a") b. strWord = strWord.Insert(2, "a") c. strWord = strWord.Insert(3, "a") d. strWord = strWord.Into(3, "a"c)

strWord = strWord.Insert(2, "a")

Which event is triggered when the computer processes the Me.Close() statement entered in the btnExit_Click procedure? a. the form's Closing event b. the form's FormClosing event c. the btnExit control's Closing event d. the btnExit control's FormClosing event

the form's FormClosing event

Which of the following indicates whether a variable is being passed by value or by reference? a. the calling statement b. the receiving procedure's header c. the statements entered within the receiving procedure d. All of the above

the receiving procedure's header

Write a statement that reads the entire file associated with the inFile variable and assigns the file's contents to the txtDocument control.

txtDocument.Text = inFile.ReadtoEnd

Write a Handles clause that associates a procedure with the TextChanged events for the txtFirst and txtSecond controls.

txtFirst.TextChanged, txtSecond.TextChanged

Write a statement that moves the insertion point to the txtName control.

txtName.Focus()

How can an application access the Private variables in a class? a. directly b. using properties created by Public Property procedures c. through Private procedures contained in the class d. None of the above

using properties created by Public Property procedures


Kaugnay na mga set ng pag-aaral

MODULE 43 - Depressive Disorders and Bipolar Disorders

View Set

SOCI Extra Credit Quizzes Exam 3

View Set

Evaluación educativa Primer Parcial

View Set

Unit 14: Types of Pooled Investments

View Set

Development: Abnormal Development Practice Questions

View Set

Chapter 4 Savings and Payment Services

View Set

Vocabulary Workshop, Level Orange (Unit 18)

View Set