IS 371 Chapters 6 & 7

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

To determine whether a variable is being passed to a procedure by value or by reference, you will need to examine______________________.

the procedure header

The items in a combo box belong to which collection?

Items

How many times will the MessageBox.Show method in the following code be processed? Dim intCount As Integer Do While intCount > 4 MessageBox.Show("Hello") intCount = intCount +1 Loop

0

The loop controlled by the For clause from the following code will end when the intX variable contains the number ______________. For intX As Integer = 10 To 99

100

How many times will the MessageBox.Show method in the following code be processed? For intCount As Integer = 6 To 13 Step 2 MessageBox.Show("Hello") Next intCount

4

Which of the following methods is used to add items to a list box?

Add

The items in a list box belong to the _______ collection.

Items

Each memory location listed in the parameterList in the the procedure header is referred to as ________________.

a parameter

The instructions in a ________________ loop might not be processed at all, whereas the instructions in a ____________ loop are always processed at least once.

pretest loop, posttest loop

How many times will the MessageBox.Show method in the following code be processed? Dim intCount As Integer Do MessageBox.Show("Hello") intCount += 1 Loop While intCount > 4

0 or 1

The computer will stop processing the loop in the following code when the intCount variable contains the number _____. For intCount As Integer = 6 To 13 Step 2 MessageBox.Show("Hello") Next intCount

14

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 = intSum + intX Next intX intY = intY + 1 Loop lblSum.Text = Convert.ToString(intSum)

30

Which property is used to specify a combo box's style?

DropDownStyle

The memory locations listed in the parameterList in a procedure header have procedure scope and are removed from the computer's internal memory when the procedure ends.

False

A form's _____________ event is triggered when you click the Close button on its title bar.

FormClosing

A form's ______________ event it triggered when the computer processes the Me.Close() statement.

FormClosing

Which of the following properties stores the index of the item selected in a list box?

SelectedIndex

The _____________ event occurs when the user selects a different item in a list box.

SelectedValueChanged

The item that appears in the text portion of a combo box is stored in which property?

Text

The ______________ 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.

TextChanged

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 & ControlChars.NewLine Next intX a. *** b. *** c. ** d. *** *** *** ** *** *** ** *** ***

a. *** ***

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

a. Call GetArea(dblLength, dblWidth)

Which of the following statements should you use to call the GetEndingInventory procedure below? Private Sub GetEndingInventory(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As integer, ByRef intFinal As Integer) a. Call GetEndingInventory(intBegin, intSales, intPurchases, intEnding) b. Call GetEndingInventory( ByVal intBegin, ByVal intSales, ByVal intPurchases, ByRef intEnding) c. Call GetEndingInventory( ByRef intBegin, ByRef intSales, ByRef intPurchases, ByRef intEnding) d. Call GetEndingInventory( ByVal intBegin, ByVal intSales, ByVal intPurchases, ByVal intEnding)

a. Call GetEndingInventory(intBegin, intSales, intPurchases, intEnding)

A Sub procedure named GetEngingInventory is passed four Integer variables named intBegin, intSales, intPurchases, and intEnding. The procedure should calculate the ending inventory using the beginning inventory, sales, and purchase amounts passed to the procedure. The result should be stored in the intEnding variable. Which of the following procedure headers is correct? a. Private Sub GetEndingInventory(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As integer, ByRef intFinal As Integer) b. Private Sub GetEndingInventory(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As integer, ByVal intFinal As Integer) c. Private Sub GetEndingInventory(ByRef intB As Integer, ByRef intS As Integer, ByRef intP As integer, ByVal intFinal As Integer) d. Private Sub GetEndingInventory(ByRef intB As Integer, ByRef intS As Integer, ByRef intP As integer, ByRef intFinal As Integer)

a. Private Sub GetEndingInventory(ByVal intB As Integer, ByVal intS As Integer, ByVal intP As integer, ByRef intFinal As Integer)

Which of the following instructs a function to return the contents of the dblBonus variable? a. Return dblBonus b. Return ByVal dblBonus c. Send dblBonus d. SendBack dblBonus

a. Return dblBonus

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

a. dblTotal += dblScore

Which of the following statements selects the "Horse" item, which appears third in the lstAnimal control? a. lstAnimal.SelectedIndex = 2 b. lstAnimal.SelectedIndex = 3 c. lstAnimal.SelectedItem = 2 d. lstAnimal.SelectedItem = 3

a. lstAnimal.SelectedIndex = 2

The items listed in the Call statement referred to as __________________.

arguments

Which of the following is false? a. A function can return only 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. At times, a memory location inside the computer's internal memory may have more than one name.

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

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. All of the above

b. 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. either a or b

b. For...Next

Which of the following rounds the contents of the dblNum variable to three decimal places? a. Math.Round(3, dblNum) b. Math.Round(dblNum, 3) c. Round.Math(dblNum, 3) d. Round.Math(3, dblNum)

b. Math.Round(dblNum, 3)

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

b. To pass a variable by reference in Visual Basic, you include the ByRef keyword before the variable's name in the Call statement.

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

b. e.Cancel = True

If the statement Call CalcNet(decNetPay) passes the variable's address, the variable is said to be passed _____________.

by reference

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 GetFree(intBase As Integer, decRate as Decimal) b. Private Sub GetFree(ByRef intBase As Integer, ByRef decRate As Decimal) c. Private Sub GetFree(ByVal intBase As Integer, ByVal decRate As Decimal) d. none of the above

c. Private Sub GetFree(ByVal intBase As Integer, ByVal decRate As Decimal)

Which of the following statements pauses program execution for 1 second? a. System.Threading.Thread.Pause(1000) b. System.Threading.Thread.Pause(1) c. System.Threading.Thread.Sleep(1000) d. System.Threading.Thread.Sleep(100)

c. System.Threading.Thread.Sleep(1000)

Which of the following is false? a. The order of the arguments listed in the Call 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 Call statement should match the data type of its corresponding parameter in the procedure header. c. The name of each argument in the Call statement should be identical to the name of its corresponding parameter in the procedure header. d. When you pass information to a procedure by value, the procedure stores the value of each item it receives in a separate memory location.

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

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

c. decDiscount = GetDiscount(decSales, decRate)

Which of the following clauses stops 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

d. 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

d. all of the above

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

d. both a and c

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(ByContents strName As String) b. Private Sub DisplayName(ByValue strName As String) c. Private Sub DisplayName ByVal(strName As String) d. none of the above

d. none of the above

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 GetFree(ByVal decX As Decimal, ByAdd intY As Integer) b. Private Sub GetFree(decX As Decimal, intY As Integer) c. Private Sub GetFree(ByRef decX As Decimal, ByRef intY As Integer) d. none of the above

d. none of the above

A procedure allows the user to enter one or more values. The first input instruction will get the first value only and is referred to as the _____________ read.

priming


संबंधित स्टडी सेट्स

Combo with SIA Computer Excel Chapter 2

View Set

Respiratory System Chapter 29 Saunders

View Set