Deck 4: Making 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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/77
Play
Full screen (f)
Deck 4: Making Decisions
1
A(n) ____________ is a set of statements that execute in the order that they appear.
A) control structure
B) ordered structure
C) command structure
D) sequence structure
A) control structure
B) ordered structure
C) command structure
D) sequence structure
D
2
The ____________ has two possible paths of execution - one path is taken if the Boolean expression is true, and the other path is taken if the Boolean expression is false.
A) dual-alternative decision structure
B) comparative structure
C) multi-decision structure
D) branching structure
A) dual-alternative decision structure
B) comparative structure
C) multi-decision structure
D) branching structure
A
3
Which one of the following operators is the best choice when determining if a number is outside a range?
A) &&
B) !
C) ||
D) >=
A) &&
B) !
C) ||
D) >=
C
4
A(n) ____________ determines whether a specific relationship exists between two values.
A) relational operator
B) bitwise assessment
C) associative operator
D) comparative structure
A) relational operator
B) bitwise assessment
C) associative operator
D) comparative structure
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
5
An action that is ____________ occurs only when a certain condition is true.
A) conditionally executed
B) logically executed
C) interactively driven
D) truth bound
A) conditionally executed
B) logically executed
C) interactively driven
D) truth bound
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
6
____________ are decision structures that appear inside other decision structures.
A) paired decision structures
B) hidden decision structures
C) dual decision structures
D) nested decision structures
A) paired decision structures
B) hidden decision structures
C) dual decision structures
D) nested decision structures
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
7
The C# language provides the ____________ data type that you can use to create variables that hold values.
A) bool
B) int
C) decimal
D) double
A) bool
B) int
C) decimal
D) double
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
8
The C# language provides a set of operators known as ____________, which you can use to create complex Boolean expressions.
A) Boolean operators
B) relational operators
C) logical operators
D) expressional operators
A) Boolean operators
B) relational operators
C) logical operators
D) expressional operators
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
9
The ____________ operator is the logical NOT operator, which is a unary operator that takes a Boolean expression as its operand and reverses its logical value.
A) <>
B) !
C) &&
D) ||
A) <>
B) !
C) &&
D) ||
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
10
A(n) ____________ is a logical design that controls the order in which a set of statements execute.
A) elementary structure
B) logic structure
C) control structure
D) sequence structure
A) elementary structure
B) logic structure
C) control structure
D) sequence structure
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
11
The ____________ operator is the logical AND operator, which takes two Boolean expressions as operands and creates a compound Boolean expression that is true only when both subexpressions are true.
A) !
B) <>
C) &&
D) ||
A) !
B) <>
C) &&
D) ||
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
12
Which one of the following expressions determines if the value of the balance variable is equal to zero?
A) 0 = balance
B) balance == 0
C) balance = 0
D) 0 == balance
A) 0 = balance
B) balance == 0
C) balance = 0
D) 0 == balance
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
13
Both the && and || operators perform ____________, in which CPU time is saved by not checking the expression on the right side of the operator depending on the value of the expression on the left side of the operator.
A) logical optimization
B) short-circuit evaluation
C) cycle-branching
D) single-stage execution
A) logical optimization
B) short-circuit evaluation
C) cycle-branching
D) single-stage execution
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
14
C# provides a special version of the decision structure known as the ____________, which simplifies the logic for testing a series of conditions.
A) if-else-if statement
B) else-try statement
C) series statement
D) logic structure
A) if-else-if statement
B) else-try statement
C) series statement
D) logic structure
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
15
A ____________ decision structure provides only one alternative path of execution.
A) unique-alternative
B) single-alternative
C) duel-alternative
D) direct-alternative
A) unique-alternative
B) single-alternative
C) duel-alternative
D) direct-alternative
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
16
A ____________ is an expression that can be evaluated as either.
A) binary expression
B) double expression
C) Boolean expression
D) classical expression
A) binary expression
B) double expression
C) Boolean expression
D) classical expression
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
17
The ____________ operator is the logical OR operator, which takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the subexpressions is true.
A) !
B) &&
C) <>
D) ||
A) !
B) &&
C) <>
D) ||
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
18
A(n) ____________ can execute a set of statements only under certain circumstances.
A) sequence structure
B) decision structure
C) circumstantial structure
D) event structure
A) sequence structure
B) decision structure
C) circumstantial structure
D) event structure
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
19
Which one of the following expressions determines whether the value of the length variable is greater than or equal to the value of the width variable?
A) length < width
B) width <= length
C) length > width
D) length >= width
A) length < width
B) width <= length
C) length > width
D) length >= width
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
20
A(n) ____________ statement has two parts: an if clause and an else clause.
A) logic
B) if-else
C) branching
D) else-if
A) logic
B) if-else
C) branching
D) else-if
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
21
A(n) ____________ is a variable that signals when some condition exists in a program.
A) sentinel
B) flag
C) event
D) marker
A) sentinel
B) flag
C) event
D) marker
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
22
In Visual C#, you use the ____________ to create a list box on an application's form.
A) ListView control
B) MaskedTextBox control
C) CheckedListBox control
D) ListBox control
A) ListView control
B) MaskedTextBox control
C) CheckedListBox control
D) ListBox control
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
23
Anytime a RadioButton or a CheckBox control's Checked property changes, a ____________ happens for that control.
A) SelectionChanged event
B) Checked event
C) CheckChanged event
D) Click event
A) SelectionChanged event
B) Checked event
C) CheckChanged event
D) Click event
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
24
The ____________ keyword is required when specifying a variable as an output variable.
A) in
B) out
C) extern
D) static
A) in
B) out
C) extern
D) static
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
25
When you want to create a group of radio buttons on a form, you use the ____________, which is found in the Common Controls section of the Toolbox.
A) RadioButton control
B) ListBox control
C) ListView control
D) ComboBox control
A) RadioButton control
B) ListBox control
C) ListView control
D) ComboBox control
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
26
To convert a string to a double, we use the ____________ method.
A) String.ToDouble
B) double.TryParse
C) Try.ParseDouble
D) ToString
A) String.ToDouble
B) double.TryParse
C) Try.ParseDouble
D) ToString
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
27
Once you create a ListBox control, you add items you wish to display to its ____________.
A) Display property
B) Text property
C) Items property
D) Values property
A) Display property
B) Text property
C) Items property
D) Values property
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
28
The ____________ method can be used to convert a string to an int.
A) Try.Parse.int
B) int.Parse
C) int.TryParse
D) TryParse.int
A) Try.Parse.int
B) int.Parse
C) int.TryParse
D) TryParse.int
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
29
The ____________ method can be used to determine whether one string is greater than or less than another string.
A) String.Equals
B) String.Compare
C) String.IsGreater
D) String.String
A) String.Equals
B) String.Compare
C) String.IsGreater
D) String.String
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
30
The process of inspecting input before it is processed is called ____________.
A) parsing
B) input validation
C) pre-rendering
D) data authentication
A) parsing
B) input validation
C) pre-rendering
D) data authentication
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
31
The ____________ is a multiple-alternative decision structure, which allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.
A) switch statement
B) if statement
C) try-catch statement
D) else statement
A) switch statement
B) if statement
C) try-catch statement
D) else statement
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
32
When you want to create a check box on a form, you use the ____________, which is found in the Common Controls section of the Toolbox.
A) CheckBox control
B) RadioButton control
C) ListBox control
D) LinkLabel control
A) CheckBox control
B) RadioButton control
C) ListBox control
D) LinkLabel control
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
33
You can use the ____________ operator to compare two strings.
A) ||
B) &&
C) ==
D) !
A) ||
B) &&
C) ==
D) !
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
34
____________ works by automatically deselecting any other items in the same group when a single item is selected.
A) multiple selection
B) mutually inclusive selection
C) mutually exclusive selection
D) monographic selection
A) multiple selection
B) mutually inclusive selection
C) mutually exclusive selection
D) monographic selection
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
35
A(n) ____________ is a variable that is passed as an argument to a method, and when the method is finished, a value is stored in the variable.
A) output variable
B) result variable
C) parameter variable
D) method variable
A) output variable
B) result variable
C) parameter variable
D) method variable
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
36
A ____________ appears as a small box with some accompanying text.
A) list box
B) link
C) check box
D) radio button
A) list box
B) link
C) check box
D) radio button
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
37
A string can be converted to a decimal with the ____________ method.
A) decimal.ParseString
B) decimal.ToString
C) Try.Parse(decimal)
D) decimal.TryParse
A) decimal.ParseString
B) decimal.ToString
C) Try.Parse(decimal)
D) decimal.TryParse
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
38
With the ____________ methods, you can determine whether a string contains a value that can be converted to a specific data type before it is converted to that data type.
A) Preemptive
B) TryParse
C) Peek
D) String.Compare
A) Preemptive
B) TryParse
C) Peek
D) String.Compare
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
39
RadioButton controls have a ____________ property that determines whether the control is selected or deselected.
A) Selected
B) Checked
C) Pushed
D) Active
A) Selected
B) Checked
C) Pushed
D) Active
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
40
____________ are useful when you want the user to select one choice from several possible choices.
A) Radio buttons
B) Check boxes
C) Buttons
D) Text boxes
A) Radio buttons
B) Check boxes
C) Buttons
D) Text boxes
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
41
If the expression is true, the ! operator returns false, and if the expression is false, the ! operator returns true.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
42
All it takes for an && expression to be true is for one side of the && operator to be true.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
43
If no item is selected in the ListBox, the SelectedIndex property is set to what value?
A) false
B) true
C) 0
D) -1
A) false
B) true
C) 0
D) -1
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
44
For debugging purposes, it's important to use proper alignment and indentation in a nested if statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
45
When the user selects an item in a ListBox, the item's index is stored in the Listbox's ____________ property.
A) DataValue
B) SelectedIndex
C) Index
D) ValueIndex
A) DataValue
B) SelectedIndex
C) Index
D) ValueIndex
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
46
If you are writing an if statement that has only one conditionally executed statement, you must enclose the conditionally executed statement in curly braces.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
47
For an || expression to be true, the expression on the left side of the || operator must be false.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
48
A long series of nested if-else statements is usually easier to follow than the logic of an if-else-if statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
49
In code we write a dual-alternative decision structure as an if-else statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
50
When the user selects an item in a ListBox, the item is stored in the ListBox's ____________ property.
A) Checked
B) SelectedValue
C) DataSelection
D) SelectedItem
A) Checked
B) SelectedValue
C) DataSelection
D) SelectedItem
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
51
In a flowchart, the diamond symbol indicates some condition that must be tested.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
52
Under no circumstances are both sets of conditionally executed statements executed in an if-else statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
53
In C#, you use the if statement to write a single-alternative decision structure.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
54
If the expression on the left side of the || operator is true, the expression on the right side is not checked.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
55
Decision structures are also known as selection structures.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
56
Boolean expressions are named in honor of the English mathematician George Boole.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
57
You never have to use the if-else-if statement because its logic can be coded with nested if-else statements.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
58
The items that are stored in a ListBox each have a(n) ____________, which is simply a number that identifies the item's position in the ListBox.
A) index
B) list number
C) unique identifier
D) table key
A) index
B) list number
C) unique identifier
D) table key
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
59
The equality operator is one = symbol.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
60
The sequence structure is heavily used in programming because it can handle every type of task.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
61
Check boxes are similar to radio buttons, in that they are both mutually exclusive.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
62
A switch statement's test expression can be of any data type.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
63
The name radio button refers to the old car radios that had push buttons for selecting stations where only one button could be pushed in at a time.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
64
A well-designed program should validate the contents of multiple TextBoxes in a single statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
65
You cannot compare string variables with string literals.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
66
To create a CheckChanged event handle for a RadioButton or a CHeckBox, simply double-click the control in the Designer.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
67
Once you create a ListBox control, you add items to its Collection property.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
68
The saying "garbage in, garbage out" refers to the fact that computers cannot tell the difference between good input and bad input.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
69
You should use try-catch statements primarily for those exceptions that are beyond your control.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
70
When determining whether a number is inside a range, it is best to use the && operator.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
71
RadioButton controls are grouped depending on the container in which they are placed.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
72
When displaying an item from a ListBox, you have to call the SelectedItem property's ToString method to retrieve the value as a string.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
73
The && and || logical operators have lower precedence than the relational operators, while the ! operator has higher precedence than the relational operators.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
74
Because the TryParse methods return either, they are commonly called as the Boolean expression in an if statement.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
75
RadioButton controls have a Text property, which hold the text that is displayed next to the radio button's circle.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
76
Variables of the int data type are commonly used as flags.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck
77
When a program compares characters, it actually compares the codes for the characters.
Unlock Deck
Unlock for access to all 77 flashcards in this deck.
Unlock Deck
k this deck