Thursday, February 26, 2009

Chapter 4

Review Questions




  1. Which of the following is a valid condition for an if...Then...Else statement?


  2. state.ToUper( ) = "Alaska" OrElse state.ToUpper( ) =
    "Hawaii"


  3. Assume you want to compare the string contained in the Text property of
    the firstNameTextBox with the name Bob. Which of the following conditions
    should you use in the If...Then...Else statement?


  4. firstNameTextBox,Text.ToUpper( ) = "BOB"


  5. The expression 3 > 6 AndAlso 7 < 4 evaluates to _______.


  6. False


  7. The expression 4 > 6 OrElse 10 < 2 * 6 evaluates to _______.


  8. False


  9. The expression 7 > = 3 + 4 Or 6 < 4 And 2 < 5 evaluates to _______.


  10. True






    If num = 1 Then
    nameLabel.Text = "Janet"
    ElseIf num = 2 OrElse num = 3 Then
    nameLabel.Text = "Paul"
    ElseIf num = 4 Then
    nameLabel.Text = "Jerry"
    Else
    nameLabel.Text = "Sue"
    End If




  11. What will the proceeding code display when the num variable contains the number 2?


  12. Paul


  13. What will the proceeding code display when the num variable contains the number 4?


  14. Jerry


  15. What will the proceeding code display when the num variable contains the number 6?


  16. Paul


  17. What will the proceeding code display when the num variable contains the number 8?


  18. Sue


  19. A nested selection structure can appear in _______ of another selection structure


  20. only the false path


  21. If the selectorExpression used in the Select Case statement is an integer
    variable named code, which of the following Case clauses is valid?


  22. All of the Above






    Select Case num

    Case 1
    nameLabel.text = "Janet"

    Case 2 To 4
    nameLabel.Text = "Paul"

    Case 5, 7
    nameLabel.Text = "Jerry"

    Case Else
    nameLabel.Text = "Sue"

    End Select




  23. What will the proceeding Select Case statement display when the num variable contains
    the number 12?


  24. Paul


  25. What will the proceeding Select Case statement display when the num variable contains
    the number 3?


  26. Paul


  27. What will the proceeding Select Case statement display when the num variable contains
    the number 6?


  28. Jerry


  29. Which of the following constants can be used to advance the insertion point to the next
    line in the AnswerLabel?


  30. Advance.NewLine


  31. Which of the following methods dteremine whether the cityName variable contains data?


  32. String.IsNullOrEmpty(cityName)


  33. If the user clicks the OK button in a message box displayed by the MessageBox.Show method,
    the message box returns the number 1, which is equivalent to which value?


  34. MessageBox.OK


  35. Which of the following generates a random integer from 10 to 55,
    inclusive? (The Random object anmed randomGenerator.)


  36. randomGenerator.Next(10,55)


  37. Assume the city variable contains the string "Boston" and the state
    variable contains the string "MA" (the city, a comma, a space ad the state) in the
    addressLabel control?


  38. addressLabel.Text = city & ", "state"


  39. Assume that a Select Case statement selectorExpression is an Integer
    variable. Which of the following Case clauses tells the computer to process the
    instructions when the Integer varibale contains one of the following numbers:
    1,2,3,4 or 5?


  40. Case 1 To 5


No comments: