VB Chapter 5 Review Questions

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

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

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

a. *** ***

The loop controlled by the correct For clause from Review Question 13 will end when the intX variable contains the number __________. a. 100 b. 111 c. 101 d. 110

a. 100

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

a. 4, 35, 3, 1, 12

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

a. Add

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

a. Items

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

a. dblTotal += dblSales

In addition to the sequence structure, which of the following control structures is used in flowchart A in Figure 5-46? a. selection b. repetition c. Both a and b

a. selection

In addition to the sequence structure, which of the following control structures is used in flowchart C in Figure 5-46? a. selection b. repetition c. Both a and b

a. selection

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 a. zero b. one c. four d. five

a. zero

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)

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

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

b. SelectedIndex

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 a. three b. four c. five d. eight

b. four

How many times will the string literal "Hi" appear in the lblMsg control? Dim intCount As Integer Do lblMsg.Text = lblMsg.Text & "Hi" & ControlsChars.NewLine intCount += 1 Loop While intCount > 4 a. zero b. one c. four d. five

b. one

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

b. pretest, posttest

In addition to the sequence structure, which of the following control structures is used in flowchart B in Figure 5-46? a. selection b. repetition c. Both a and b

b. repetition

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

c. 1, 12, 3, 35, 4

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

c. All of the above

In addition to the sequence structure, which of the following control structures is used in flowchart D in Figure 5-46? a. selection b. repetition c. Both a and b

c. Both a and b

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

c. SelectedValueChanged

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

c. form's AcceptButton

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

c. lstNames.SelectedIndex = 3

The computer will stop processing the loop in Review Question 6 when the intCount variable contains the number __________. a. 11 b. 12 c. 13 d. 14

d. 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 += intX Next intX intY += 1 Loop lblSum.Text = intSum.ToString a. 5 b. 8 c. 15 d. 30

d. 30

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

d. All of the above


Kaugnay na mga set ng pag-aaral

Chapter 28: Assisting with the Physical Examination

View Set

PPT 14: Contracts: Agreement - Contract Acceptance

View Set

The History of the English Language: Test

View Set