Deck 4: The Selection Structure
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/60
Play
Full screen (f)
Deck 4: The Selection Structure
1
What is the value of the following expression: 9 * 2 - 8 > 5 + 2 / 2?
A)10
B)6
C)False
D)True
A)10
B)6
C)False
D)True
D
2
The expression 12 > 0 AndAlso 12 < 10 * 2 evaluates to True.
True
3
Comparison operators are always evaluated after arithmetic operators in a conditional expression.
True
4
When coding a selection instruction in Visual Basic,the code that follows the Else statement includes those instructions that will be executed when the condition is true.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
5
The ____ operator is evaluated first in the following expression: 9 * 2 - 8 > 5 + 2 / 2.
A)-
B)+
C)>
D)*
A)-
B)+
C)>
D)*
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
6
You can include an identifying label on a group box by setting the group box's Identity property.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
7
If the intInventory variable contains the value 28,the condition If intInventory <= 25 Then will evaluate to ____.
A)Yes
B)No
C)True
D)False
A)Yes
B)No
C)True
D)False
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
8
The diamond symbol is used in a flowchart for a calculation task.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
9
The ____ operator is evaluated last in the following expression: 9 * 2 - 8 > 5 + 2 / 2.
A)-
B)+
C)>
D)*
A)-
B)+
C)>
D)*
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
10
The ____ operator expresses "not equal to."
A)>
B)<>
C)>=
D)<=
A)>
B)<>
C)>=
D)<=
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following conditions will evaluate to True when the intPackages variable contains the value 100?
A)If intPackages = 100 Then
B)If intPackages <> 0 Then
C)If intPackages > 1 Then
D)All of the above would evaluate to True.
A)If intPackages = 100 Then
B)If intPackages <> 0 Then
C)If intPackages > 1 Then
D)All of the above would evaluate to True.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
12
The Not operator would make a True statement False,but would not make a False statement True.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
13
If dblMiles >= 500 Then dblMiles = dblMiles * 0.45
Else
DblMiles = dblMiles * 0.25
End If
The dblMiles variable contains the number 575 before the code above is processed.What value will be in the variable after the code is processed?
A)0
B)143.75
C)225
D)258.75
Else
DblMiles = dblMiles * 0.25
End If
The dblMiles variable contains the number 575 before the code above is processed.What value will be in the variable after the code is processed?
A)0
B)143.75
C)225
D)258.75
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
14
Use the ____ flowchart symbol to represent the condition in both the selection and repetition structures.
A)oval
B)rectangle
C)parallelogram
D)diamond
A)oval
B)rectangle
C)parallelogram
D)diamond
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
15
The And operator always checks both conditions,while the AndAlso operator does not always evaluate the second condition.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
16
A programmer must phrase the condition of a selection structure so that it results in either a true or a false answer only.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
17
A variable that has ____ scope can be used anywhere within the procedure.
A)block
B)statement
C)method
D)procedure
A)block
B)statement
C)method
D)procedure
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
18
Before using a string in a comparison,you can use either the ToUpper method or the ToLower method to convert the string to uppercase or lowercase,respectively,and then use the converted string in the comparison.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
19
The expression 2 * 3 + 1 > 1 * 2 + 3 Or 7 + 2 < 4 + 1 evaluates to False.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
20
Comparison operators are also referred to as ____ operators.
A)relational
B)arithmetic
C)logical
D)Boolean
A)relational
B)arithmetic
C)logical
D)Boolean
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
21
Consider the expression 3 * 2 ^ 2 < 16 + 5 AndAlso 100 / 10 * 2 > 15 - 3.Which operation is performed second?
A)^
B)/
C)*
D)+
A)^
B)/
C)*
D)+
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
22
If the intQuantity and decPrice variables contain the numbers 3 and 15.75,respectively,the condition If intQuantity > 0 AndAlso intQuantity < 10 OrElse decPrice > 20 will evaluate to ____.
C)Yes
D)No
C)Yes
D)No
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following statements assigns the contents of the txtGrade control,in uppercase,to the strGrade variable?
A)If strGrade = txtGrade.Text.ToUpper Then
B)strGrade.ToUpper = txtGrade.Text
C)strGrade = txtGrade.Text.ToUpper
D)txtGrade.Text.ToUpper = strGrade
A)If strGrade = txtGrade.Text.ToUpper Then
B)strGrade.ToUpper = txtGrade.Text
C)strGrade = txtGrade.Text.ToUpper
D)txtGrade.Text.ToUpper = strGrade
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
24
The Backspace key is represented by the ____ constant.
A)ControlChars.Back
B)ControlChars.BackSpace
C)ControlChars.Backspace
D)ControlChars.Backspc
A)ControlChars.Back
B)ControlChars.BackSpace
C)ControlChars.Backspace
D)ControlChars.Backspc
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
25
In the MessageBox.Show(text,caption,buttons,icon[,defaultButton])method,which of the following arguments controls the symbol appearing in the message box?
A)text
B)caption
C)buttons
D)icon
A)text
B)caption
C)buttons
D)icon
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
26
Consider the expression 3 * 2 ^ 2 < 16 + 5 AndAlso 100 / 10 * 2 > 15 - 3.Which operation is performed last?
A)^
B)<
C)>
D)AndAlso
A)^
B)<
C)>
D)AndAlso
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
27
With the KeyPress event,use the e parameter's ____ property to cancel the key if it is an inappropriate one.
A)Check
B)KeyEnter
C)KeyChar
D)Handled
A)Check
B)KeyEnter
C)KeyChar
D)Handled
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
28
In the MessageBox.Show(text,caption,buttons,icon[,defaultButton])method,which of the following arguments controls the words appearing in the message box?
A)text
B)caption
C)buttons
D)icon
A)text
B)caption
C)buttons
D)icon
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
29
In the MessageBox.Show(text,caption,buttons,icon[,defaultButton])method,which of the following arguments controls the words appearing on the message box title bar?
A)text
B)caption
C)buttons
D)icon
A)text
B)caption
C)buttons
D)icon
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
30
You use the ____ method to select all of the text contained in a text box.
A)All
B)SelectAll
C)AllText
D)GetAll
A)All
B)SelectAll
C)AllText
D)GetAll
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
31
Consider the expression 3 * 2 ^ 2 < 16 + 5 AndAlso 100 / 10 * 2 > 15 - 3.Which operation is performed first?
A)^
B)/
C)*
D)+
A)^
B)/
C)*
D)+
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
32
You can use a(n)____ to visually separate related controls from other controls on the form.
A)radio button
B)check box
C)group box
D)icon area
A)radio button
B)check box
C)group box
D)icon area
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
33
To prevent a text box from accepting inappropriate characters,you first use the e parameter's ____ property to determine the key that the user pressed.
A)KeyStruck
B)KeyEnter
C)KeyChar
D)KeyPress
A)KeyStruck
B)KeyEnter
C)KeyChar
D)KeyPress
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following If clauses would evaluate to True and apply the 10% discount for a commercial customer?
A)If strCustomer <> "C" AndAlso strMember <> "Y"
B)If strCustomer = "C" AndAlso strMember = "Y"
C)If strCustomer <> "R" OrElse strMember = "Y"
D)If strCustomer = "C" OrElse strMember = "Y"
A)If strCustomer <> "C" AndAlso strMember <> "Y"
B)If strCustomer = "C" AndAlso strMember = "Y"
C)If strCustomer <> "R" OrElse strMember = "Y"
D)If strCustomer = "C" OrElse strMember = "Y"
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
35
Logical operators are sometimes referred to as ____ operators.
A)relational
B)arithmetic
C)comparison
D)Boolean
A)relational
B)arithmetic
C)comparison
D)Boolean
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
36
A control's ____ event occurs each time the user presses a key while the control has the focus.
A)PressEnter
B)KeyEnter
C)KeyPress
D)FocusPress
A)PressEnter
B)KeyEnter
C)KeyPress
D)FocusPress
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
37
The application needs to display a message box to remind the clerk to ask customers to join the Rental Rewards Program when they check out.This message box should only display if the customer is not currently in the program.Which of the following If clauses would evaluate to True and display the message box for the clerk?
A)If strMember <> "Y" Then
B)If strMember = "Y" Then
C)If strMember = "N" Then
D)a and c
A)If strMember <> "Y" Then
B)If strMember = "Y" Then
C)If strMember = "N" Then
D)a and c
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
38
A text box's ____ event occurs when the text box receives the focus.
A)Focus
B)It
C)Key
D)Enter
A)Focus
B)It
C)Key
D)Enter
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
39
The ____ method displays a message box that contains text,one or more buttons,and an icon.
A)MessageBox.Display
B)MessageBox.Group
C)MessageBox.Show
D)MessageBox.Output
A)MessageBox.Display
B)MessageBox.Group
C)MessageBox.Show
D)MessageBox.Output
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following has the most limited scope?
A)a variable declared at the beginning of a procedure
B)a variable declared within the true path of a selection structure
C)a static variable declared at the beginning of a procedure
D)a class-level variable
A)a variable declared at the beginning of a procedure
B)a variable declared within the true path of a selection structure
C)a static variable declared at the beginning of a procedure
D)a class-level variable
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
41
Write an If clause to determine whether the dblTemp variable contains a number that is between 65 and 75.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
42
Write an If...Then...Else statement that displays the string "Balance Due" in the lblMessage control when the decBalance variable contains a number that is greater than 0; otherwise,assign the string "Thank you for your payment."
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
43
The button selected by the clerk will determine the next task performed by the computer.The application is using the ____ of the MessageBox.Show method.
A)Boolean value
B)return value
C)selection structure
D)function
A)Boolean value
B)return value
C)selection structure
D)function
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
44
What is a group box and how is it used?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
45
An application needs to display whether or not a student has been accepted to college.The program needs to display either "Accepted" or "Not Accepted".A student must have an SAT score of 1750 or higher and a GPA of 3.3 or higher.Rewrite the following If statement to correct all errors:
If intSAT <= 1750 OrElse decGPA >= 3.3 Then
lblMessage.Text = "Not Accepted"
Else
lblMessage.Text = "Accepted"
End If
If intSAT <= 1750 OrElse decGPA >= 3.3 Then
lblMessage.Text = "Not Accepted"
Else
lblMessage.Text = "Accepted"
End If
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
46
An application needs to calculate a discount for customers who are either preferred customers or senior citizens.Preferred customers have a discount code of "P".Senior citizens have a discount code of "S".The discount code is stored in the strCode variable.Write an If clause to calculate a discount for all preferred members and senior citizens using the strCode variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
47
If a customer decides to enroll in the Rental Rewards Program,the Member Information Form displays for the clerk to enter the membership data for the customer.Which of the following statements sends the focus to the txtFirstName control and highlights any text within it?
A)SelectAll(txtFirstName.text)
B)txtFirstName.SelectAll()
C)Focus(txtFirstName.text)
D)txtFirstName.Focus()
A)SelectAll(txtFirstName.text)
B)txtFirstName.SelectAll()
C)Focus(txtFirstName.text)
D)txtFirstName.Focus()
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
48
The message provided when a customer is not a current member of the Rental Rewards Program is "Enroll this customer in the Rental Rewards Program?".The clerk must enter a decision before the application can continue.Which of the message box buttons should be used?
A)OK
B)OKCancel
C)YesNo
D)Information
A)OK
B)OKCancel
C)YesNo
D)Information
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
49
Complete the chart shown below.


Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
50
Write an If...Then...Else statement that assigns the number 2000 to the intBonus variable when the decSales variable contains a number that is greater than or equal to $50,000; otherwise,assign the number 500.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
51
Write an If clause to determine whether the user pressed the Backspace key.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
52
Write an If clause that will determine if the strColor variable contains either the string "red" or the string "blue".
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
53
Gino's Subs & Pies wants an application that allows a user to enter a customer's order total and address.When a customer purchases $30 or more of food,Gino's offers free delivery.The delivery fee for all other orders is $10.The calculation should display the total amount the customer owes,including any delivery fee.Draw the flowchart for the solution to this problem.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
54
Write a statement that changes the contents of the txtStatus control's text property to uppercase and stores it in the strStatus variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
55
An application needs to display the message "Please add water" when the amount of water has fallen below the safe limit.Rewrite the following If statement to correct all errors:
If intWaterLimit < intWaterAmount Then
lblWarning = "Please add water"
End If
If intWaterLimit < intWaterAmount Then
lblWarning = "Please add water"
End If
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
56
Write a statement that creates a message box that displays an OK button,an Information icon,"Harris Pharmacy" in the title bar,and the message "Please enter a pickup time for your order".
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
57
List the three most commonly used icons for display in a message box.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
58
What is a selection structure? What is the difference between a single-alternative and dual-alternative selection structure?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
59
Write an If statement that allows only numbers and a decimal place to be accepted.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
60
Your professor wants an application that allows a student to enter two grades and calculate the average of those grades.The application should display the message "Pass" if the average of the grades is 70 or greater.The application should display the message "Fail if the average of the grades is less than 70.Write the pseudocode for the solution to this problem.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck