Chapter 5 VB exam
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)
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
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 += 1Loop lblSum.Text = intSum.ToString a. 5 b. 8 c. 15 d. 30
30
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
Which of the following methods is used to add items to a list box? a. Add b. AddList c. Item d. ItemAdd
Add
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 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.
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
Both a and b
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
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
Four
The items in a list box belong to which collection? a. Items b. List c. ListItems d. Values
Items
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 A. Zero B. One C. Four D. Five
One
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 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
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.
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
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
Zero
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. *** ***
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 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