Programming exam 2

Ace your homework & exams now with Quizwiz!

The loop controlled by the correct For clause from Review Question 13 will end when the intX variable contains the number ...

100

The computer will stop processing the loop in Review Question 6 when the intCount variable contains the number ...

14

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

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

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

A

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 methods is used to add items to a list box? a. Add b. AddList c. Item d. ItemAdd

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

A

Check My Work 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

B

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

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.

B

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

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

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

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

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

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

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

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

endless loop

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

accumulator

a numeric variable used for accumulating (adding together) something

counter

a numeric variable used for counting something

To make the btnCalc control the default button, you need to set the _________ property.

form's acceptbutton

The instructions in a _______ loop might not be processed at all, whereas the instructions in a ______ loop are always processed at least once

pretest; posttest

Initializing

the process of assigning a beginning value to a memory location, such as a counter or accumulator variable


Related study sets

Non-Traditional Mortgages (Oregon CE 2021)

View Set

The Iroquois Creation Myth: "The World on Turtle's Back"

View Set

NCLEX Women's Health and Maternity/Newborn Drugs

View Set