Quiz3-DecisionStructures&BooleanLogic Flashcards
In many languages == operator determines whether one variable has the same value as another variable. (T/F)
True
The OR operator will evaluate to True only if both subexpressions are also True (T/F)
False
In an expression with an OR operator, it does not matter which subexpression is true for the compound expression to be true. (T/F)
True
A nested decision structure can be used to test more than one condition. (T/F)
True
A nested decision structure can achieve the same logic as a case structure. (T/F)
True
The first line of a case structure starts with the word CASE, followed by the test expression. (T/F)
False
A decision structure will produce unpredictable results if the programmer does not use proper indentation in the pseudocode.(T/F)
False
An If-Then-Else statement must be used to write a single alternative decision structure.(T/F)
False
The short-circuit evaluation is always performed with all expressions that contain any logical operators.(T/F)
False
Decision structures and selection structures are completely different.(T/F)
False
The following statement will evaluate to True: (T/F)
(5 > 6) OR (12 < 14)
True
The following statement will evaluate to True: (T/F)
(5 > 6) AND (12 < 14)
False
In a flowchart, the _________ symbol indicates that some condition must be tested.
diamond
What type of operator determines whether a specific relationship exists between two values?
A) relational
B) Boolean
C) Mathmatical
A) relational
Which operator is used in most languages to test if two operands DO NOT have the exact same value?
!=
A case structure is a _________ alternative decision structure.
Multiple alternative decision structure
Which of the following is NOT a logical operator?
A) AND
B) OR
C) NOT
D) All are logical operators
D) All are logical operators
Which of the following is NOT a logical operator?
A) <>
B) OR
C) AND
A) <>
The ________ operator is a unary operator, which means it works with only one operand.
NOT
If an expression is FALSE, the __________ operator will return TRUE.
NOT
Which two logical operators perform short-circuit evaluation?
AND and OR
In many languages, the case structure is called a ___________ statement.
Switch
What would be displayed if the following pseudocode was coded and executed, with salary = 400?
If salary > 400 Then
Set bonus = 10
Set salary = salary + bonus
End If
Display Salary
400
What would be displayed if the following pseudocode was coded and executed, with salary = 400?
If salary > 400 Then
Set bonus = 10
Set salary = salary + bonus
Else
Set salary = salary + salary*.20
End If
Display Salary
480
Set salary = 400 + (400.20)
400.20 =80
400+80=480