Deck 4: Decisions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/86
Play
Full screen (f)
Deck 4: Decisions
1
The operator And is a(n) ____________operator.
A) arithmetic
B) relational
C) logical
D) none of the above
A) arithmetic
B) relational
C) logical
D) none of the above
logical
2
Which of the following is true?
A) "Cat" = "cat"
B) "Cat" < "cat"
C) "Cat" > "cat"
D) Relational operators are only valid for numeric values.
A) "Cat" = "cat"
B) "Cat" < "cat"
C) "Cat" > "cat"
D) Relational operators are only valid for numeric values.
B
3
Asc("A") is 65. What is displayed by txtBox.Text = Chr(65) & "BC"?
A) ABC
B) A BC
C) 656667
D) Not enough information is available.
A) ABC
B) A BC
C) 656667
D) Not enough information is available.
A
4
In Visual Basic, the letter j is considered to be greater than the letter y.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
5
Which value for x would make the following condition true: Not (x >= 5)
A) x is equal to 7
B) x is equal to 4
C) x is equal to 5.001
D) All of the above
A) x is equal to 7
B) x is equal to 4
C) x is equal to 5.001
D) All of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
6
The And operator requires that both conditions be true for the compound condition to be true.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
7
The statement txtBox.Text = Chr(162) causes Visual Basic to display the cents symbol (ANSI 162) in the text box, regardless of the font in use.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
8
When using the logical operator "Or", what part of the expression must be true?
A) only the left part
B) only the right part
C) either the left or right part, but not both
D) either the left or right part
A) only the left part
B) only the right part
C) either the left or right part, but not both
D) either the left or right part
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
9
The following two statements are equivalent.
Not (a < b)
a > b
Not (a < b)
a > b
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
10
The condition "Y" = "y" is true.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
11
If two simple conditions are true, the compound condition created from them by the Or operator is also true.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
12
Asc("A") is 65. What is Asc("C")?
A) 66
B) 67
C) 68
D) "C"
A) 66
B) 67
C) 68
D) "C"
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
13
Which statement is false?
A) "Ford" >= "Ford"
B) "Chevy" <= "chevy"
C) "GMC" <= "GMC"
D) "Oldsmobile" < "Oldsmobile"
A) "Ford" >= "Ford"
B) "Chevy" <= "chevy"
C) "GMC" <= "GMC"
D) "Oldsmobile" < "Oldsmobile"
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
14
Which value for x would make the following condition true: x >= 5
A) x is equal to 7
B) x is equal to 5
C) x is equal to 5.001
D) All of the above
A) x is equal to 7
B) x is equal to 5
C) x is equal to 5.001
D) All of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following is a valid Visual Basic conditional statement?
A) 2 < n < 5
B) 2 < n Or < 5
C) 2 < n Or 5
D) (2 < n) Or (n < 5)
A) 2 < n < 5
B) 2 < n Or < 5
C) 2 < n Or 5
D) (2 < n) Or (n < 5)
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following expressions has as its value the words "Hello World" surrounded by quotation marks?
A) "Hello World"
B) Chr(34) & "Hello World"
C) Chr(34) & Hello World & Chr(34)
D) Chr(34) & "Hello World" & Chr(34)
A) "Hello World"
B) Chr(34) & "Hello World"
C) Chr(34) & Hello World & Chr(34)
D) Chr(34) & "Hello World" & Chr(34)
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
17
Which statement is true?
A) "Ford" < "Ford"
B) "Chevy" > "Chevy"
C) "GMC" <= "GMC"
D) "oldsmobile" < "Oldsmobile"
A) "Ford" < "Ford"
B) "Chevy" > "Chevy"
C) "GMC" <= "GMC"
D) "oldsmobile" < "Oldsmobile"
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
18
The three main logical operators are____________ , _____________ , and ____________.
A) And, Or, Not
B) And, Not, If
C) Or, Not, If
D) False, And, True
A) And, Or, Not
B) And, Not, If
C) Or, Not, If
D) False, And, True
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
19
"1st Place" < "2nd Place"
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
20
When is the expression "Not cond1" true?
A) when cond1 is false
B) when cond1 is true
C) when cond1 is either true or false
D) None of the above
A) when cond1 is false
B) when cond1 is true
C) when cond1 is either true or false
D) None of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
21
The following lines of code are correct.
If age >= 13 And < 20 Then
txtOutput.Text = "You are a teenager."
End If
If age >= 13 And < 20 Then
txtOutput.Text = "You are a teenager."
End If
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
22
The value of "education".EndsWith("on") is True.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
23
Assume that A, B, and C are conditions, with A being true, B being true, and C being false. Give the truth value of (A And Not (B or C)).
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
24
Given that x = 7, y = 2, and z = 4, the following If block will display "TRUE".
If (x > y) Or (y > z) Then txtBox.Text = "TRUE"
End If
If (x > y) Or (y > z) Then txtBox.Text = "TRUE"
End If
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
25
Assume that A, B, and C are conditions, with A being true, B being true, and C being false. Give the truth value of (Not (A And B)).
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
26
Conditions can involve variables, operators, and functions.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
27
Given that x = 7, y = 2, and z = 4, the following If block will display "TRUE".
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
28
Two strings are compared working from left to right, character by character, to determine which one should precede the other.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
29
The following condition evaluates to True.
"DOG" > "CAT") And ("CAT" > "BIRD") And ("BIRD" > "aardvark")
"DOG" > "CAT") And ("CAT" > "BIRD") And ("BIRD" > "aardvark")
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
30
The value of IsNumeric("$20.00") is True.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
31
Assume that A, B, and C are conditions, with A being true, B being true, and C being false. Give the truth value of (A And (Not B)).
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
32
If two simple conditions are true, the compound condition created from them by the And operator is also true.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
33
Is the following condition True or False (assume a = 2, b = 3, and c = 3)? (a = c) Or (b = c)
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
34
The value of IsNumeric("Twenty") is True.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
35
The value of "education".StartsWith("ED") is True.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
36
< and = are examples of relational operators.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
37
What will be the output of the following program when the button is clicked? Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim As Double
If Then
Else
End If
txtBox. Text = CStr
End Sub
A) 6
B) 3
C) 0
D) No output
Dim As Double
If Then
Else
End If
txtBox. Text = CStr
End Sub
A) 6
B) 3
C) 0
D) No output
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
38
What will be displayed by the following program when the button is clicked? Private Sub btnDisplay_Click (...) Handles btnDisplay.Click
Dim As Double
If Then
Else
If Then
Else
txtBox. Text = CStr
End If
End If
End Sub
A) 1
B) 2
C) 3
D) None of the above
Dim As Double
If Then
Else
If Then
Else
txtBox. Text = CStr
End If
End If
End Sub
A) 1
B) 2
C) 3
D) None of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
39
When an If block has completed execution, the program instruction immediately following the If block is executed.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
40
The following lines of code are correct.
If (txtAge.Text >= 62) Then
txtOutput.Text = "You are elegible to collect Social Security."
End If
If (txtAge.Text >= 62) Then
txtOutput.Text = "You are elegible to collect Social Security."
End If
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
41
No more than one ElseIf statement may occur in any one If block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
42
No more than one Else statement may occur in any one If block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
43
A variable declared inside an If block ceases to exist after the block is exited.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
44
The following line of code is valid.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
45
What will be displayed in the list box when the following code runs? SSelect Case num
Case 6, 7, 11
lstBox. Items . Add ("W")
Case Is
lstBox. Items . Add ("X")
Case Is > 5
lstBox. Items . Add ("Y")
Case Else
ls tBox. Items . Add ("Z")
End Select
A) Z can never be displayed.
B) W, X and Y will be displayed if the value of num is 6.
C) W and Y will be displayed if the value of num is 7.
D) Z will always be displayed.
Case 6, 7, 11
lstBox. Items . Add ("W")
Case Is
lstBox. Items . Add ("X")
Case Is > 5
lstBox. Items . Add ("Y")
Case Else
ls tBox. Items . Add ("Z")
End Select
A) Z can never be displayed.
B) W, X and Y will be displayed if the value of num is 6.
C) W and Y will be displayed if the value of num is 7.
D) Z will always be displayed.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
46
One may use an If block within a Select Case block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
47
In a Select Case block, if more than one Case clause matches the selector,
A) only the statements associated with the first matching Case clause will be executed.
B) all of the statements associated with each matching Case clause will be executed.
C) only the statements associated with the last matching Case clause will be executed.
D) the program will malfunction and stop.
A) only the statements associated with the first matching Case clause will be executed.
B) all of the statements associated with each matching Case clause will be executed.
C) only the statements associated with the last matching Case clause will be executed.
D) the program will malfunction and stop.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
48
The Case Else part of a Select Case block is optional.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
49
A variable declared inside a Select Case block cannot be referred to by code outside of the block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
50
Why is the following Select Case block invalid in Visual Basic? Select Case myName. Substring
Case myName "D"
txtBox. Text = "Your name starts with A, B, or C."
End Select
A) There should not be a standard conditional expression in a value list.
B) There are not enough Case statements.
C) There is no selector.
D) myName.Substring(0, 1) is not valid where it is.
Case myName "D"
txtBox. Text = "Your name starts with A, B, or C."
End Select
A) There should not be a standard conditional expression in a value list.
B) There are not enough Case statements.
C) There is no selector.
D) myName.Substring(0, 1) is not valid where it is.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
51
A single Case statement can contain multiple values.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
52
The following line of code is valid.
If 0 ? grade ? 100 Then
If 0 ? grade ? 100 Then
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
53
One may use a Select Case block within an If block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
54
Every Select Case block can be replaced by If blocks.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
55
Items in the value list must evaluate to a literal of the same type as the selector.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
56
Every If block must have a Then and an Else.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
57
What type of items are valid for use in the value list of a Case clause?
A) literals
B) variables
C) expressions
D) All of the above
A) literals
B) variables
C) expressions
D) All of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
58
You can specify a range of values in a Case clause by using the To keyword.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
59
One may use a Select Case block within another Select Case block.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
60
Select Case choices are determined by the value of an expression called a selector.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
61
Which of the following techniques does NOT always toggle the checked and unchecked state of a check box control?
A) Click on the square or its caption with the mouse.
B) Press the spacebar when the square has the focus.
C) Press Alt+Access key (if an access key has been specified).
D) Set the Checked property equal to 1.
A) Click on the square or its caption with the mouse.
B) Press the spacebar when the square has the focus.
C) Press Alt+Access key (if an access key has been specified).
D) Set the Checked property equal to 1.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
62
A radio button named radButton is placed on a form, and the statement MessageBox.Show(radButton.Checked) is placed in its CheckedChanged event procedure. At run time, what result will be displayed in the message box when the user clicks on radButton?
A) 1
B) True
C) 2
D) False
A) 1
B) True
C) 2
D) False
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
63
A collection of related radio buttons is usually placed in a_________ .
A) List box
B) Text box
C) Collection Editor
D) Group box
A) List box
B) Text box
C) Collection Editor
D) Group box
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
64
Clicking on a checked check box unchecks the check box.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
65
What is the key difference between a group of check boxes attached to a group box and a group of radio buttons attached to a group box?
A) Only radio buttons can be toggled.
B) Only one radio button at a time can be checked.
C) Check boxes cannot be attached to a group box.
D) The only difference is the shape of the control.
A) Only radio buttons can be toggled.
B) Only one radio button at a time can be checked.
C) Check boxes cannot be attached to a group box.
D) The only difference is the shape of the control.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
66
Clicking on a checked radio button unchecks the radio button.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
67
Which of the following statements turns on the radio button radButton?
A) radButton = True
B) radButton.On = True
C) radButton.Checked = True
D) radButton.Selected = True
A) radButton = True
B) radButton.On = True
C) radButton.Checked = True
D) radButton.Selected = True
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
68
Which of the following techniques always toggles the "on" and "off" states of a radio button control?
A) Click on the circle or its caption with the mouse.
B) Press the spacebar when the circle has the focus.
C) Press on another radio button in the same group box.
D) Set the Checked property equal to True.
E) None of the above
A) Click on the circle or its caption with the mouse.
B) Press the spacebar when the circle has the focus.
C) Press on another radio button in the same group box.
D) Set the Checked property equal to True.
E) None of the above
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
69
Which of the following is not commonly used to allow the user to select among several options?
A) a collection of radio buttons
B) a collection of check boxes
C) a list box
D) a collection of text boxes
A) a collection of radio buttons
B) a collection of check boxes
C) a list box
D) a collection of text boxes
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
70
At design time, values can be placed into a list box via the _________.
A) String Editor
B) String Collection Editor
C) Collection Editor
D) Items Editor
A) String Editor
B) String Collection Editor
C) Collection Editor
D) Items Editor
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
71
A check box control named chkFirst contains the following code in its CheckedChanged event procedure. Which of the following is true concerning the use of this control?
Dim message As String = "hello"
MessageBox.Show(message)
A) The message "hello" will appear when the user checks the control but not when it is unchecked.
B) The message "hello" will appear when the user unchecks the control but not when it is checked.
C) The message "hello" will appear when the user checks the control and again when it is unchecked.
D) The message "hello" will not appear using this code.
Dim message As String = "hello"
MessageBox.Show(message)
A) The message "hello" will appear when the user checks the control but not when it is unchecked.
B) The message "hello" will appear when the user unchecks the control but not when it is checked.
C) The message "hello" will appear when the user checks the control and again when it is unchecked.
D) The message "hello" will not appear using this code.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
72
The default event procedure for a list box is _________.
A) SelectedIndexChanged
B) Click
C) CheckedChanged
D) IndexChanged
A) SelectedIndexChanged
B) Click
C) CheckedChanged
D) IndexChanged
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
73
. The value of lstBox.Text is the currently selected item of the list box.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
74
Suppose there are four radio button controls attached to a group box control on a form. How many radio buttons can be selected (that is, be "on") at any given time?
A) 2
B) 1
C) 3
D) 4
A) 2
B) 1
C) 3
D) 4
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
75
When the user clicks on a check box control at run time, which one of the following events is raised (in addition to the Click event)?
A) ControlAdded
B) Invalidated
C) StyleChanged
D) CheckedChanged
A) ControlAdded
B) Invalidated
C) StyleChanged
D) CheckedChanged
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
76
The default event procedure for a check box is _________.
A) SelectedIndexChanged
B) Click
C) CheckedChanged
D) Checked
A) SelectedIndexChanged
B) Click
C) CheckedChanged
D) Checked
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
77
When a check box is checked, the value of the Checked property will be
A) True.
B) False.
C) 1.
D) 0.
A) True.
B) False.
C) 1.
D) 0.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
78
The title (as seen by the user) for the group box control is set by which one of the following properties?
A) Text
B) Name
C) Tag
D) Anchor
A) Text
B) Name
C) Tag
D) Anchor
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
79
After several controls of the same type have been created, they can be moved inside a group box and thereby become attached to it.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck
80
With a check box control, toggling the state of the small square raises the CheckChanged event.
Unlock Deck
Unlock for access to all 86 flashcards in this deck.
Unlock Deck
k this deck