Deck 4: Decisions and Conditions
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/51
Play
Full screen (f)
Deck 4: Decisions and Conditions
1
When a program executes a Call statement and the called procedure completes executing its code,program execution resumes on the statement following the call.
True
2
Or and And are logical operators used in compound expressions.
True
3
When using Select Case,the group of statements must end with End Case.
False
4
In an If / Then / Else statement,the Else clause is optional.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
5
The AND operator requires that both conditions be True for the compound expression to be True.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
6
It's a good idea to always use the ToUpper or ToLower method on the Text property of text boxes,whenever comparing string values.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
7
In an If statement,when the expression is false,only the Else clause,if present,is executed.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
8
The Unified Modeling Language (UML)can be used to nest If statements in code.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
9
A block of If / Then / Else must begin with an If statement and end with an EndOfIf statement.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
10
The code: If NumberAInteger > NumberBInteger OR NumberBInteger > NumberCInteger Then,evaluates True when NumberAInteger = 3,NumberBInteger = 5,and NumberCInteger = 2.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
11
Event procedures may be called from any procedure within the form.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
12
The code: If NumberAInteger > NumberBInteger AND NumberBInteger > NumberCInteger Then,evaluates True when NumberAInteger = 3,NumberBInteger = 5,and NumberCInteger = 2.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
13
When a CheckBox is checked,the Checked property will return a value of True.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
14
A CheckBox may be tested to determine if it is checked by using the following code:
If TestChecked.Checked Then
If TestChecked.Checked Then
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
15
If statements containing additional Ifs are said to be nested If statements.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
16
Usually,the code written for a Case structure is simpler and easier to read than if the same code was written with nested Ifs.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
17
The code: If NumAInteger <> NumBInteger Then,evaluates True when NumAInteger = 3 and NumBInteger = 5.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
18
Each ELSE will be matched with the last unmatched IF,regardless of indentation.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
19
"If RedRadioButton.Checked Then" is valid code for checking if a radio button is selected.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
20
AndAlso is a logical operator that will "short-circuit" if the first expression is False.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
21
Nested Ifs are allowed,_______.
A)But you are limited to only 4 levels of Ifs
B)But each If must have an End If
C)Can be difficult to follow if they are nested too deeply
D)Both answers b and c are correct.
A)But you are limited to only 4 levels of Ifs
B)But each If must have an End If
C)Can be difficult to follow if they are nested too deeply
D)Both answers b and c are correct.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
22
When comparing strings,which one of the following strings is less than the others,based on the ANSI code?
A)ONETWOTHREE
B)onetwothree
C)OneTwoThree
D)1Two3
A)ONETWOTHREE
B)onetwothree
C)OneTwoThree
D)1Two3
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following is NOT a logical operator?
A)If
B)Or
C)And
D)Not
A)If
B)Or
C)And
D)Not
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
24
With the logical operator _______,if the first expression is True,the second expression will not be evaluated.
A)And
B)Or
C)AndAlso
D)OrElse
A)And
B)Or
C)AndAlso
D)OrElse
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
25
A line of code that is marked as a breakpoint will have a large red dot in the left margin and the code will be highlighted in red.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
26
In an If statement,when the expression is true,_______.
A)Only the Else clause is executed
B)Only the ElseIf clause is executed
C)Only the End If statement is executed
D)Only the Then clause is executed
A)Only the Else clause is executed
B)Only the ElseIf clause is executed
C)Only the End If statement is executed
D)Only the Then clause is executed
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
27
With the logical operator _______,both expressions must be true for the entire expression to evaluate True.
A)And
B)Or
C)AndAlso
D)OrElse
A)And
B)Or
C)AndAlso
D)OrElse
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following is a comparison operator?
A)And
B)>
C)+
D)&
A)And
B)>
C)+
D)&
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
29
The Show method of a MessageBox returns a _______ object that you can check to see which button the user clicked.
A)Show
B)ShowMe
C)Selected
D)DialogResult
A)Show
B)ShowMe
C)Selected
D)DialogResult
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
30
It is not necessary to use the Call keyword when you want to call another event procedure.Simply list the object name,an underscore,the event,and the parentheses.If the procedure that you are calling requires arguments,place the arguments within the parentheses.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
31
An If contained within another If statement is _______.
A)A nested If
B)A compound expression
C)An embedded contradiction
D)Impossible to do in VB
A)A nested If
B)A compound expression
C)An embedded contradiction
D)Impossible to do in VB
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
32
Once a Visual Basic event procedure is executing,there is no way of stopping execution before an error causes it to stop.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following is correct code for determining if a checkbox is checked?
A)If Senior.Checkbox = True Then
B)If SeniorCheckBox.Checked = True Then
C)If SeniorCheckBox.Checked Then
D)Both answers B and C are correct.
A)If Senior.Checkbox = True Then
B)If SeniorCheckBox.Checked = True Then
C)If SeniorCheckBox.Checked Then
D)Both answers B and C are correct.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
34
To set a breakpoint,place the mouse pointer in the gray margin indicator area at the left edge of the Editor window and click.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following statements does NOT apply to the Case structure?
A)It can be used instead of nested Ifs.
B)It can be used for testing numeric and string values.
C)It must begin with Select Case and it must end with End Case.
D)Case Else is optional.
A)It can be used instead of nested Ifs.
B)It can be used for testing numeric and string values.
C)It must begin with Select Case and it must end with End Case.
D)Case Else is optional.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
36
When a project is running and it reaches a breakpoint in the code,the program will halt,display the line with the breakpoint and go into debug time.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
37
______________ will be the result of: MessageText.Text = MessageText.Text.ToUpper()when the value of MessageText.Text is "Visual Basic is fun!".
A)Visual Basic is fun!
B)VISUAL BASIC IS FUN!
C)visual basic is fun!
D)VisualBasicisfun!
A)Visual Basic is fun!
B)VISUAL BASIC IS FUN!
C)visual basic is fun!
D)VisualBasicisfun!
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
38
What will display in MessageLabel when the following statements are executed? Assume that CountInteger = 10. MessageString = "Visual Basic is fun"
IF CountInteger <= 10 Then
MessageLabel.Text = MessageString.ToLower()
ELSEIF CountInteger > 20 Then
MessageLabel.Text = MessageString.ToUpper()
ELSE
MessageLabel.Text = MessageString
END IF
A)VISUAL BASIC IS FUN
B)Visual Basic Is Fun
C)visual basic is fun
D)syntax error
IF CountInteger <= 10 Then
MessageLabel.Text = MessageString.ToLower()
ELSEIF CountInteger > 20 Then
MessageLabel.Text = MessageString.ToUpper()
ELSE
MessageLabel.Text = MessageString
END IF
A)VISUAL BASIC IS FUN
B)Visual Basic Is Fun
C)visual basic is fun
D)syntax error
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
39
Use the Visual Studio intrinsic constant,_______,to determine line endings.
A)VB.Multiline
B)Environment.NewLine
C)VS.NewLine
D)VB.NewLine
A)VB.Multiline
B)Environment.NewLine
C)VS.NewLine
D)VB.NewLine
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
40
Checking to verify that appropriate values have been entered for a text box is called _______.
A)verification
B)validation
C)a MessageBox
D)a watch expression
A)verification
B)validation
C)a MessageBox
D)a watch expression
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
41
What are the six comparison operators? Give an example using each one.
(Student's answers may vary. )
Operator Example
> CorrectInteger > 75
< NameText.Text.ToUpper()< NameString.ToUpper()
= PasswordText.Text.ToUpper()= "SECRET"
<> GraduateRadioButton.Checked <> True
>= PriceDecimal >= PriceTotalDecimal
<= GradeDecimal <= TotalGradeDecimal
(Student's answers may vary. )
Operator Example
> CorrectInteger > 75
< NameText.Text.ToUpper()< NameString.ToUpper()
= PasswordText.Text.ToUpper()= "SECRET"
<> GraduateRadioButton.Checked <> True
>= PriceDecimal >= PriceTotalDecimal
<= GradeDecimal <= TotalGradeDecimal
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
Use the Case structure and convert the following If statement so that it checks the string as an uppercase value.
If StateNameString = "California" Then
AdjustedPriceDecimal = PriceDecimal+(PriceDecimal * TaxDecimal)
Else
AdjustedPriceDecimal = PriceDecimal
End If
If StateNameString = "California" Then
AdjustedPriceDecimal = PriceDecimal+(PriceDecimal * TaxDecimal)
Else
AdjustedPriceDecimal = PriceDecimal
End If
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
You can write a set of instructions in an event procedure and then ________ the event procedure from any other procedure.
A)declare the variables in
B)force a break in
C)use Option Explicit in
D)call
A)declare the variables in
B)force a break in
C)use Option Explicit in
D)call
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
44
The Select Case statement must end with __________.
A)End Select
B)End Case
C)Select End
D)Case End
A)End Select
B)End Case
C)Select End
D)Case End
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
45
What is the value of MysteryInteger when the following statements are executed? Const NUMBER_Integer As Integer = 10
Select Case NUMBER_Integer
Case 1,3,5,7,9
MysteryInteger = NUMBER_Integer
Case 2,4,6,8,10
MysteryInteger = NUMBER_Integer + 1 * 2
Case Else
MysteryInteger = NUMBER_Integer * 2 + 1
End Select
A)10
B)12
C)21
D)22
Select Case NUMBER_Integer
Case 1,3,5,7,9
MysteryInteger = NUMBER_Integer
Case 2,4,6,8,10
MysteryInteger = NUMBER_Integer + 1 * 2
Case Else
MysteryInteger = NUMBER_Integer * 2 + 1
End Select
A)10
B)12
C)21
D)22
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
46
The _______ displays all objects and variables that are within scope during a break in program execution.
A)Locals window
B)Procedure Box
C)Autos window
D)Step Into
A)Locals window
B)Procedure Box
C)Autos window
D)Step Into
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
47
_______ is an optional clause available for the Case Structure when no match is found in any of the Case statements.
A)Case Else
B)Default
C)ElseIf
D)Else Case
A)Case Else
B)Default
C)ElseIf
D)Else Case
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
The Select Case statement is a code structure used for ________.
A)repetition
B)selection
C)sequence
D)none of these
A)repetition
B)selection
C)sequence
D)none of these
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
The Debug.WriteLine method will display its results in the ________ window.
A)Debug
B)Immediate
C)WriteLine
D)Breakpoint
A)Debug
B)Immediate
C)WriteLine
D)Breakpoint
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
You can use _______________ as your project executes in order to view the values of variables and control contents that are referenced in the current statement and a few statements on either side of the current statement.
A)the Locals window
B)the Procedure Box
C)the Autos window
D)Step Into
A)the Locals window
B)the Procedure Box
C)the Autos window
D)Step Into
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
When you share an event procedure with radio buttons,Visual Basic creates and passes a system variable object named,_______,which has a name property containing the name of the selected button.
A)sender
B)integer
C)source
D)number
A)sender
B)integer
C)source
D)number
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck