Deck 4: Decision Structures
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/30
Play
Full screen (f)
Deck 4: Decision Structures
1
Which type of structure is used to determine which of two sets of instructions to execute?
A) Decision structure
B) Sequence structure
C) Nested structure
D) Do together structure
E) None of these
A) Decision structure
B) Sequence structure
C) Nested structure
D) Do together structure
E) None of these
A
2
Which type of structure is used to execute a set of instructions in the order in which they appear?
A) Decision structure
B) Sequence structure
C) Nested structure
D) Do together structure
E) None of these
A) Decision structure
B) Sequence structure
C) Nested structure
D) Do together structure
E) None of these
B
3
The expression: either a == b or a != b, or both, is always true.
True
4
The Else part of the If/Else instruction must have at least one statement.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
5
Logical operators are used to compare any two numeric values.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
6
The If/Else instruction uses a Boolean condition to determine which set of instructions to execute.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
7
Relational operators are used to determine whether a specific
relationship exists between two values.
relationship exists between two values.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
8
Which type of structure has an If/Else instruction that has an empty Else part?
A) Single-alternative decision structure
B) Dual-alternative decision structure
C) Null decision structure
D) Minimum decision structure
E) None of these
A) Single-alternative decision structure
B) Dual-alternative decision structure
C) Null decision structure
D) Minimum decision structure
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
9
What would the penguin say if the following code were executed? If 5 == 4
Penguin say Yes
Else
Penguin say No
A) "Yes"
B) "No"
C) "Yes" then "No"
D) "No" then "Yes"
E) None of these
Penguin say Yes
Else
Penguin say No
A) "Yes"
B) "No"
C) "Yes" then "No"
D) "No" then "Yes"
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
10
What would the penguin say if the following code were executed? If 5 >= 4
Penguin say Yes
Else
Penguin say No
A) "Yes"
B) "No"
C) "Yes" then "No"
D) "No" then "Yes"
E) None of these
Penguin say Yes
Else
Penguin say No
A) "Yes"
B) "No"
C) "Yes" then "No"
D) "No" then "Yes"
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
11
What English mathematician are Boolean values named after?
A) Paul Boole
B) George Boole
C) John Boole
D) Ringo Boole
E) None of these
A) Paul Boole
B) George Boole
C) John Boole
D) Ringo Boole
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
12
The If/Else instruction cannot contain another If/Else instruction.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
13
Boolean expressions typically contain relational operators.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
14
If a = 6 and b = 6, then the expression a != b is true.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
15
Assuming that a = 2 and b = 3, which of the following expressions is true?
A) a > b
B) a < b
C) b <= a
D) a == b
E) None of these
A) a > b
B) a < b
C) b <= a
D) a == b
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
16
What type of operators are used to compare two numeric values?
A) Arithmetic
B) Complex
C) Logical
D) Relational
E) None of these
A) Arithmetic
B) Complex
C) Logical
D) Relational
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
17
Assuming that a = 1, b = 2, and c = 3, which of the following expressions is true?
A) both a < b and c < b
B) either a > b or b > c, or both
C) both b > a and b < c
D) either a == b or b == c, or both
E) None of these
A) both a < b and c < b
B) either a > b or b > c, or both
C) both b > a and b < c
D) either a == b or b == c, or both
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
18
The only way that a nested If/Else instruction will execute is for the
condition of the outer If/Else instruction to be true.
condition of the outer If/Else instruction to be true.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
19
The expression: both a == b and a != b, is always false.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
20
What type of operators are used to join two Boolean values?
A) Arithmetic
B) Complex
C) Logical
D) Relational
E) None of these
A) Arithmetic
B) Complex
C) Logical
D) Relational
E) None of these
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
21
The If/Else decision structure uses a ___________________ condition to determine which set of instructions to execute.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
22
The ___________________ instruction can be used to test the value of an object's property.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
23
When you ___________________ a number, you drop the factional part.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
24
___________________ operators are used to compare two numeric values.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
25
___________________ operators are used to join two or more Boolean expressions.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
26
Assume that a = 1, b = 2, and c = 3.What is the value of the expression: either a < b or b > c, or both? ___________________
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
27
In the ___________________-alternative decision structure the Else part is empty.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
28
What is the value of the expression: a == a? ___________________
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
29
Assume that a = 1, b = 2, and c = 3.What is the value of the expression: both a < b and b > c? ___________________
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
30
Assume that a = 3 and b = 2.What is the value of the expression: a < b? ___________________
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck