VB Chapter 4 Review Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

An expression can contain arithmetic, comparison, and logical operators. Indicates the order of precedence for the three type of operators by placing a number (1, 2 or 3) on the line to the left of the operator type. __________ Arithmetic __________ Logical __________ Comparison

1. Arithmetic 3. Logical 2. Comparison

Use the code shown in Figure 4-53 to answer Review Questions 9 through 12 (code shown on flipside)

If intAge <= 5 Then intCost = 0 ElseIf intAge <= 12 Then intCost = 5 ElseIf intAge <= 55 Then intCost = 10 Else intCost = 8 End If

Use the code shown in Figure 4-54 to answer Review Questions 13 through 16 (code shown on flipside)

If strLevel = "1" OrElse strLEvel = "2" Then lblStatus.Text = "Bronze" ElseIf strLevel = "3" OrElse strLEvel = "4" Then lblStatus.Text = "Silver" ElseIf strLevel = "5" Then lblStatus.Text = "Gold" Else lblStatus.Text = "Platinum" End If

Use the code shown in Figure 4-55 to answer Review Questions 19 through 22 (code shown on flipside)

Select Case intLevel Case 1, 2 strStatus = "Bronze" Case 3 T0 5 strStatus = "Silver" Case 6, 7 strStatus ="Gold" Case Else strStatus = "Platinum" End Select

The six logical operators are listed below. Indicate their order of precedence by placing a number (1, 2, and so on) on the line to the left of the operator. If two or more operators have the same precedence, assign the same number to each. __________ Xor __________ And __________ Not __________ Or __________ AndAlso __________ OrElse

4. Xor 2. And 1. Not 3. Or 2. AndAlso 3. OrElse

A form contains six check boxes. Three of the check boxes are located in a group box. How many of the check boxes on the form can be selected at the same time? a. one b. two c. three d. six

d. six

What will the code in Figure 4-53 assign to the intCost variable when the intAge variable contains the number 2? a. 0 b. 5 c. 8 d. 10

a. 0

What will the code in Figure 4-54 assign to the lblStatus control when the strLevel variable contains the string "2"? a. Bronze b. Gold c. Platinum d. Silver

a. Bronze

What will the code in Figure 4-55 assign to the strStatus variable when the intLevel variable contains the number 1? a. Bronze b. Gold c. Platinum d. Silver

a. Bronze

If a radio button is selected, its __________ property contains the Boolean value True. a. Checked b. On c. Selected d. Selection

a. Checked

Which of the following If clauses determines whether the user pressed the Backspace key? a. If e.KeyChar = ControlChars.Back Then b. If e.KeyChar = Backspace Then c. If e.KeyChar = ControlChars.Backspace Then d. If ControlChars.Backspace = True Then

a. If e.KeyChar = ControlChars.Back Then

Evaluate the following expression: 13 > 12 OrElse 6 < 5. a. True b. False

a. True

Evaluate the following expression: 8 <= 4 + 6 AndAlso 5 > 6 OrElse 4 < 7. a. True b. False

a. True

When entered in the appropriate even procedure, which of the following statements cancels the key pressed by the user? a. e.Handled = True b. e.Handled = False c. e.KeyCancel = True d. e.KeyCancel = False

a. e.Handled = True

Which of the following compound conditions determines whether the value in the intOrdered variable is outside the range of 0 through 25? a. intOrdered < 0 OrElse intOrdered > 25 b. intOrdered > 0 AndAlso intOrdered < 25 c. intOrdered <= 0 OrElse intOrdered >= 25 d. intOrdered < 0 AndAlso intOrdered > 25

a. intOrdered < 0 OrElse intOrdered > 25

Which capitalization should be used for the text appearing in check boxes and radio buttons? a. sentence capitalization b. book title capitalization c. either book title capitalization or sentence capitalization d. None of the above

a. sentence capitalization

What will the code in Figure 4-53 assign to the intCost variable when the intAge variable contains the number 12? a. 0 b. 5 c. 8 d. 10

b. 5

Evaluate the following expression: 5 * 4 > 6 ^ 2 AndAlso True OrElse False. a. True b. False

b. False

Evaluate the following expression: 5 * 7 > 6 ^ 2. a. True b. False

b. False

Evaluate the following expression: 6 + 3 > 7 AndAlso 11 < 2 * 5. a. True b. False

b. False

Evaluate the following expression: 7 + 3 * 2 > 6 * 3 AndAlso True. a. True b. False

b. False

It is customary in Windows applications to designate a default check box? a. True b. False

b. False

What will the code in Figure 4-54 assign to the lblStatus control when the strLevel variable contains the string "5"? a. Bronze b. Gold c. Platinum d. Silver

b. Gold

What will the code in Figure 4-55 assign to the strStatus variable when the intLevel variable contains the number 7? a. Bronze b. Gold c. Platinum d. Silver

b. Gold

Which of the following If clauses determines whether the user pressed the % key? a. If ControlChars.PercentSign = True Then b. If e.KeyChar = "%" Then c. If e.KeyChar = Chars.PercentSign Then d. If e.KeyChar.ControlChars = "%" Then

b. If e.KeyChar = "%" Then

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

b. dblTotal *= dblRate

What is the minimum number of radio buttons in a group? a. one b. two c. three d. There is no minimum number of radio buttons

b. two

What will the code in Figure 4-53 assign to the intCost variable when the intAge variable contains the number 65? a. 0 b. 5 c. 8 d. 10

c. 8

Which of the following events occurs when a check box is clicked? a. Changed b. Checked c. CheckedChanged d. None of the above

c. CheckedChanged

If a check box is not selected, what value is contained in its Checked property? a. True b. Unchecked c. False d. Unselected

c. False

What will the code in Figure 4-54 assign to the lblStatus control when the strLevel variable contains the string "10"? a. Bronze b. Gold c. Platinum d. Silver

c. Platinum

What will the code in Figure 4-55 assign to the strStatus variable when the intLevel variable contains the number 8? a. Bronze b. Gold c. Platinum d. Silver

c. Platinum

Where can a nested selection structure appear? a. only in an outer selection structure's false path b. only in an outer selection structure's true path c. in either of an outer selection structure's paths d. only in another nested selection structure's true or false paths

c. in either of an outer selection structure's paths

What will the code in Figure 4-53 assign to the intCost variable when the intAge variable contains the number 33? a. 0 b. 5 c. 8 d. 10

d. 10

Which of the following Case clauses is valid in a Select Case statement whose selectorExpression is an Integer variable named intAge? a. Case Is > 21 b. Case 21, 65 c. Case 1 To 10 d. All of the above

d. All of the above

Which of the following If clauses compares the string contained in the txtId control with the abbreviation for the state of Georgia? a. If ToUpper(txtId.Text.Trim) = "GA" Then b. If txtId.Text.Trim.ToUpper = "GA" Then c. If txtId.Text.ToLower.Trim = "ga" Then d. Both b and c

d. Both b and c

Which of the following If clauses will evaluate to True when the Bonus check box is selected? a. If chkBonus.Check = True Then b. If chkBonus.Checked Then c. If chkBonus.Checked = True Then d. Both b and c

d. Both b and c

When entering data in text box, each key the user presses invokes the text box's __________ event. a. Focus b. Key c. KeyFocus d. KeyPress

d. KeyPress

What will the code in Figure 4-54 assign to the lblStatus control when the strLevel variable contains the string "3"? a. Bronze b. Gold c. Platinum d. Silver

d. Silver

What will the code in Figure 4-55 assign to the strStatus variable when the intLevel variable contains the number 4? a. Bronze b. Gold c. Platinum d. Silver

d. Silver


Ensembles d'études connexes

Human Resource MGM Chapter: 11 Managing Labor Relations

View Set

KAPLAN NURSING ENTRANCE EXAM-SPECIAL SENSES

View Set

5.3 Independence and The Multiplication Rule (unit 2)

View Set

Chapter 3 Health, Wellness, and Health Disparities

View Set

TAX Chapter 1/2 Standard Deduction/ Exemptions

View Set

LearningCurve: 11a. Stress and Illness

View Set

Retirement and other insurance concepts

View Set