Review Questions
- Which of the following is a valid condition for an if...Then...Else statement?
- state.ToUper( ) = "Alaska" OrElse state.ToUpper( ) =
"Hawaii" - 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? - firstNameTextBox,Text.ToUpper( ) = "BOB"
- The expression 3 > 6 AndAlso 7 < 4 evaluates to _______.
- False
- The expression 4 > 6 OrElse 10 < 2 * 6 evaluates to _______.
- False
- The expression 7 > = 3 + 4 Or 6 < 4 And 2 < 5 evaluates to _______.
- True
- What will the proceeding code display when the num variable contains the number 2?
- Paul
- What will the proceeding code display when the num variable contains the number 4?
- Jerry
- What will the proceeding code display when the num variable contains the number 6?
- Paul
- What will the proceeding code display when the num variable contains the number 8?
- Sue
- A nested selection structure can appear in _______ of another selection structure
- only the false path
- If the selectorExpression used in the Select Case statement is an integer
variable named code, which of the following Case clauses is valid? - All of the Above
- What will the proceeding Select Case statement display when the num variable contains
the number 12? - Paul
- What will the proceeding Select Case statement display when the num variable contains
the number 3? - Paul
- What will the proceeding Select Case statement display when the num variable contains
the number 6? - Jerry
- Which of the following constants can be used to advance the insertion point to the next
line in the AnswerLabel? - Advance.NewLine
- Which of the following methods dteremine whether the cityName variable contains data?
- String.IsNullOrEmpty(cityName)
- 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? - MessageBox.OK
- Which of the following generates a random integer from 10 to 55,
inclusive? (The Random object anmed randomGenerator.) - randomGenerator.Next(10,55)
- 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? - addressLabel.Text = city & ", "state"
- 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? - Case 1 To 5
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
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
No comments:
Post a Comment