Deck 5: Problem Solving and Control Statements
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/49
Play
Full screen (f)
Deck 5: Problem Solving and Control Statements
1
Which of the following headers will cause the body not to execute at least once?
A)For i As Integer = 1 To 10
B)For i As Integer = 1 To 10 Step 2
C)For i As Integer = 10 To 20 Step -1
D)None of the Above
A)For i As Integer = 1 To 10
B)For i As Integer = 1 To 10 Step 2
C)For i As Integer = 10 To 20 Step -1
D)None of the Above
C
2
Counter-controlled repetition requires only a control variable,an initial value for the control variable and an increment or decrement.
False
3
The control variable of the For…Next statement must have its type declared before or at the beginning of the loop.
False
4
Which of the following statements is false?
A)Case statements use the keyword Is to determine whether the controlling expression satisfies a condition.
B)Multiple values can be tested in a Case statement where the values are separated by commas.
C)Multiple values in a range can be tested using the To keyword.
D)None of the above
A)Case statements use the keyword Is to determine whether the controlling expression satisfies a condition.
B)Multiple values can be tested in a Case statement where the values are separated by commas.
C)Multiple values in a range can be tested using the To keyword.
D)None of the above
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following will count down from 10 to 1 correctly,with no added or omitted numbers?
A)For i = 10 to 0 Step -1
B)For i = 10 To 1 Step 1
C)For i As Integer = 10 To 1 Step -1
D)For i As Integer = 1 To 10 Step -1
A)For i = 10 to 0 Step -1
B)For i = 10 To 1 Step 1
C)For i As Integer = 10 To 1 Step -1
D)For i As Integer = 1 To 10 Step -1
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
6
A control variable that is declared in a For…Next statement header may not be used outside of the body of the For…Next statement.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
7
Counting loops should be controlled with values.
A)Double
B)Integer
C)Char
D)None of the above.
A)Double
B)Integer
C)Char
D)None of the above.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
8
Visual Basic's currency formatting code,C,separates a number every three digits with commas and sets the number of decimal places to two.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
9
A case can be labeled as to execute in the event that none of the provided cases are equivalent to the controlling expression.
A)General
B)Default
C)Case *
D)Case Else
A)General
B)Default
C)Case *
D)Case Else
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
10
A Case Else must be provided for every Switch statement.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
11
A While statement automatically increments a variable that a programmer specifies.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
12
For monetary calculations use the data type:
A)Single
B)Double
C)Decimal
D)Integer
A)Single
B)Double
C)Decimal
D)Integer
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following is not a control statement?
A)Do…Loop While
B)While…Do Loop
C)Select…Case
D)For…Next
A)Do…Loop While
B)While…Do Loop
C)Select…Case
D)For…Next
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
14
Counting loops should be controlled with whatever data type most closely reflects the operations taking place,whether that is an Integer,Single or Double.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following is not required for counter-controlled repetition?
A)the special value -1 to mark the end of data input
B)initial value of the control variable
C)increment or decrement by which the control variable is modified each time through the loop
D)condition that tests for the final value of the control variable.
A)the special value -1 to mark the end of data input
B)initial value of the control variable
C)increment or decrement by which the control variable is modified each time through the loop
D)condition that tests for the final value of the control variable.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
16
It is a logic error to have a positive increment in a For…Next loop that is supposed to loop 10 times when the initial value of the control variable is the final value.
A)greater than
B)less than
C)equal to
D)greater or less than
A)greater than
B)less than
C)equal to
D)greater or less than
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
17
The first line of a For…Next statement sometimes is called the For…Next _________.
A)title
B)header
C)footer
D)description
A)title
B)header
C)footer
D)description
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
18
The Visual Basic operator ^ can be used for exponentiation.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
19
The optional _________ keyword specifies the increment of the For…Next loop.
A)Increase
B)Increment
C)Step
D)Raise
A)Increase
B)Increment
C)Step
D)Raise
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
20
The expression following the keywords Select Case is called the:
A)selection expression
B)variable expression
C)controlling expression
D)case expression
A)selection expression
B)variable expression
C)controlling expression
D)case expression
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
21
The placement of a larger value on the left side of keyword To in a Case statement is a logic error and causes the case to be ignored during program execution.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
22
The Do…Loop While repetition statement tests the condition the body of the loop executes.
A)before
B)while
C)after
D)None of the above.
A)before
B)while
C)after
D)None of the above.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
23
The Exit and Continue statements cannot be used in nested repetition statements.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
24
The Do…Loop While statement is an example of a:
A)Selection statement
B)Repetition statement
C)Loop statement
D)Sequence statement
A)Selection statement
B)Repetition statement
C)Loop statement
D)Sequence statement
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
25
The Continue statement is used to undo the effects of the Exit statement.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
26
Select Case statements do not require the End Select keywords.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
27
Infinite loops occur when the loop-continuation condition in a _________ statement never becomes true.
A)While…End While
B)Do…Loop While
C)Do…Loop Until
D)Do While…Loop
A)While…End While
B)Do…Loop While
C)Do…Loop Until
D)Do While…Loop
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
28
The Exit statement terminates a program.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
29
In a Do…Loop While statement,the loop-continuation condition is tested at the end of the loop.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following statements about the Continue statement is true?
A)The Continue statement is used to exit a repetition statement early and continue execution after the loop.
B)The Continue statement is used to continue after a Select…Case statement.
C)The Continue statement does not alter the flow of control.
D)A Continue statement proceeds with the next iteration of the immediately enclosing repetition statement.
A)The Continue statement is used to exit a repetition statement early and continue execution after the loop.
B)The Continue statement is used to continue after a Select…Case statement.
C)The Continue statement does not alter the flow of control.
D)A Continue statement proceeds with the next iteration of the immediately enclosing repetition statement.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements cannot be terminated early?
A)For…Next
B)Do…Loop Until
C)If…Then
D)Select…Case
A)For…Next
B)Do…Loop Until
C)If…Then
D)Select…Case
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
32
In a Do…Loop Until statement,the loop body is not always executed.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
33
The statement,when executed in a loop,terminates the loop.
A)Continue
B)Break
C)Skip
D)Exit
A)Continue
B)Break
C)Skip
D)Exit
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following operators is typically used to ensure at least one out of multiple conditions is true?
A)Or
B)And
C)Xor
D)Not
A)Or
B)And
C)Xor
D)Not
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
35
Including an incorrect xe "relational operator"relational operator or an incorrect xe "final value of control variable"final value for a loop counter in the condition of any repetition statement often cause ____________ errors.
A)off-by-one
B)compilation
C)syntax
D)None of the above
A)off-by-one
B)compilation
C)syntax
D)None of the above
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
36
The loop body of a Do…Loop While statement always executes __________.
A)zero times
B)at least once
C)more than once
D)undeterminable
A)zero times
B)at least once
C)more than once
D)undeterminable
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
37
The Exit For statement causes immediate exit from the For…Next statement.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
38
In a Do…Loop While statement,the loop body is always executed at least once.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
39
Identify the incorrect logical operator:
A)AndAlso
B)ElseOr
C)Xor
D)Not
A)AndAlso
B)ElseOr
C)Xor
D)Not
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
40
The statement,when executed in a loop,skips the remaining statements in the body of the statement and begins the next iteration of the loop.
A)Continue
B)Break
C)Next
D)Back
A)Continue
B)Break
C)Next
D)Back
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
41
MessageBox method Show displays a message dialog,which is typically used to display an important message to the user.The arguments of MessageBox method Show are the message String,the String that's displayed in the dialog's title bar and predefined constants that specify the Button(s)and the icon to show on the dialog,respectively.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
42
The Xor operator is true if and only if one of its operands results in a true value and the other a false value.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
43
Only one CheckBox in a group can be selected at a time.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
44
A program waits for a message dialog to be closed before executing the next line of code-this type of dialog is known as a nodal dialog.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
45
If we wish to ensure that either or both of two conditions are true we should use the logical operator:
A)And
B)AndAlso
C)OrElse
D)Xor
A)And
B)AndAlso
C)OrElse
D)Xor
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
46
A CheckBox is known as a __________ button because it can be "on" or "off."
A)switch
B)alternating
C)state
D)on/off
A)switch
B)alternating
C)state
D)on/off
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
47
The performance feature for the evaluation of AndAlso and OrElse expressions is called:
A)short-circuit evaluation
B)quick evaluation
C)shortcut evaluation
D)fast evaluation
A)short-circuit evaluation
B)quick evaluation
C)shortcut evaluation
D)fast evaluation
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
48
The logical operator Not is also called logical negation.
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck
49
If a CheckBox is "on" (checked),its __________ property is True;otherwise,it's False ("off").
A)Selected
B)On
C)Chosen
D)Checked
A)Selected
B)On
C)Chosen
D)Checked
Unlock Deck
Unlock for access to all 49 flashcards in this deck.
Unlock Deck
k this deck