Wyo Visual Basic Ch. 4 Practice Test                                                    Name -

In order to thoroughly prepare for the Ch. 4 Test, you should:

True/False

  1. An If statement must have an ElseIf option.
  2. If a is True and b is False, then (a And b) is True.
  3. An even number is always evenly divisible by 2.
  4. The < symbol is a comparison operator.
  5. 20 mod 5 is 4.
  6. A Select Case statement can have 3 or more cases.
  7. It is possible to nest one If statement inside of another If statement.
  8. The ASCII value of a lowercase a is 13.
  9. The control expression ( intA > 3 ) is a compound Boolean expression.

Fill in the Blank - Write out the word True or False for the control expression problems.

  1. The operators And, Or, and Not are _____________ operators.
  2. What is the ASCII value for an uppercase 'D'?
  3. If intA = 4 and intB = 8, simplify the control expression (intB > intA * 2)
  4. If intA = 4 and intB = 8, simplify the control expression (25 Mod (intB + intA))

Write a Visual Basic statement that performs the following task.

  1. Write an If statement that displays the message "Hello" in the caption of lblMessage if the value of intGreeting is greater than 5.

  2. Write an If/ElseIf statement that displays the message "Gore" in the caption of lblVerdict if intGoreVotes is greater than intBushVotes. If intBushVotes is greater than intGoreVotes then the message "Bush won" should be displayed there. For this exercise, you can assume that intGoreVotes will not be equal to intBushVotes.

  3. Write a Select Case statement that displays the message "A" in the caption of lblOutput if the value of intGrade is 10. If the value of intGrade is 9, then the displayed message should be "B". If the value of intGrade is 8, the message should be "C". Otherwise, the message should be "E".

  4. Write a KeyPress event for a textbox named txtInput that displays a message box with the phrase "Good" if the user inputs a number that is greater than 10 followed by the Enter key.